Short description of the issue
The new PagesEditor::saveSort() method added in commit ad04e666 only fires the $pages->sorted() hook when $page is a Page instance — but whether $page is a Page or an int depends on which call shape the caller uses:
saveSort(123) — internally resolves $page = $this->pages->get(123) → Page → hook fires.
saveSort(123, 5) — passes the int through unchanged → $page stays an int → hook does not fire.
Same operation (save a sort value), different observable behavior.
Expected behavior
The sorted hook fires consistently regardless of whether the caller passes a Page object or a numeric ID.
Actual behavior
In wire/core/Pages/PagesEditor.php:
if($result && $page instanceof Page) {
$this->pages->sorted($page, false, 1);
}
Additional concern: rowCount() > 0 is used to decide $result. If the sort value already matches the requested value, rowCount() returns 0, indistinguishable from "page not found" or "DB error."
Optional: Suggestion for a possible fix
if($result) {
if(!$page instanceof Page) {
$page = $this->pages->get((int) $page);
if(!$page->id) return $result;
}
$this->pages->sorted($page, false, 1);
}
Setup/Environment
- ProcessWire version:
dev @ 15c749ed
- File:
wire/core/Pages/PagesEditor.php
- Introduced in commit ad04e666
Short description of the issue
The new
PagesEditor::saveSort()method added in commit ad04e666 only fires the$pages->sorted()hook when$pageis a Page instance — but whether$pageis a Page or an int depends on which call shape the caller uses:saveSort(123)— internally resolves$page = $this->pages->get(123)→ Page → hook fires.saveSort(123, 5)— passes the int through unchanged →$pagestays an int → hook does not fire.Same operation (save a sort value), different observable behavior.
Expected behavior
The
sortedhook fires consistently regardless of whether the caller passes a Page object or a numeric ID.Actual behavior
In
wire/core/Pages/PagesEditor.php:Additional concern:
rowCount() > 0is used to decide$result. If the sort value already matches the requested value,rowCount()returns 0, indistinguishable from "page not found" or "DB error."Optional: Suggestion for a possible fix
Setup/Environment
dev@15c749edwire/core/Pages/PagesEditor.php