Version: 3.0.268 (introduced in 3.0.258)
Steps to reproduce:
- Have a PageTable field with a specific parent_id set (e.g. a dedicated storage parent)
- Add some child pages to the PageTable on a page, then trash some of those child pages
- The stale IDs remain in the field_[name] DB table (PW doesn't always clean these up on trash)
- Upgrade to PW 3.0.258+
- Attempt to edit the page in admin → fatal error
Error:
ProcessWire\WireException: Item added to ProcessWire\PageTableArray is not an allowed type
in wire/core/WireArray/WireArray.php:322
Root cause: PageTableArray (new in 3.0.258) overrides isValidItem() to enforce parent_id validation. When wakeupPageTableValue() calls $value->import($items), trashed pages (whose parent_id is now 7 / Trash) fail the parent check and cause WireArray::add() to throw. The throwing behavior at load time is too aggressive — stale data that was valid when saved now makes pages completely uneditable.
Suggested fix (either):
- In
PageTableArray::isValidItem(), return true (or silently skip) if the item's status includes Page::statusTrash — OR —
- In
FieldtypePageTable::wakeupPageTableValue(), filter out trashed pages from $ids before calling $pages->getById() and adding to the array — OR —
- Change
WireArray::add() to not throw when isValidItem() returns false (just return $this) when called via import()
Workaround: Directly remove the stale rows from the field_[name] database table for the affected page.
Version: 3.0.268 (introduced in 3.0.258)
Steps to reproduce:
Error:
Root cause:
PageTableArray(new in 3.0.258) overrides isValidItem() to enforce parent_id validation. WhenwakeupPageTableValue()calls$value->import($items), trashed pages (whoseparent_idis now 7 / Trash) fail the parent check and causeWireArray::add()to throw. The throwing behavior at load time is too aggressive — stale data that was valid when saved now makes pages completely uneditable.Suggested fix (either):
PageTableArray::isValidItem(), return true (or silently skip) if the item's status includes Page::statusTrash — OR —FieldtypePageTable::wakeupPageTableValue(), filter out trashed pages from $ids before calling$pages->getById()and adding to the array — OR —WireArray::add()to not throw when isValidItem() returns false (just return $this) when called via import()Workaround: Directly remove the stale rows from the field_[name] database table for the affected page.