Skip to content

PageTableArray::isValidItem() throws fatal WireException on page load when PageTable references trashed pages (regression in 3.0.258) #2279

Description

@outflux3

Version: 3.0.268 (introduced in 3.0.258)

Steps to reproduce:

  1. Have a PageTable field with a specific parent_id set (e.g. a dedicated storage parent)
  2. Add some child pages to the PageTable on a page, then trash some of those child pages
  3. The stale IDs remain in the field_[name] DB table (PW doesn't always clean these up on trash)
  4. Upgrade to PW 3.0.258+
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions