Skip to content

Uncaught TypeError in admin when editing a page having Page Reference #1607

Closed
@er314

Description

@er314

Short description of the issue

As non superuser, when editing a page having a Page Reference field (which has field-level access control), the rendering of the edit view fails, with :

Fatal Error: Uncaught TypeError: Illegal offset type in isset or empty in C:\xampp\data\www_smh\www\wire\core\Page.php:978 Stack trace: #0 C:\xampp\data\www_smh\www\site\assets\cache\FileCompiler\site\modules\AdminPageFieldEditLinks\AdminPageFieldEditLinks.module(155): Page->get(Object(PageField)) #1 C:\xampp\data\www_smh\www\wire\core\WireHooks.php(1050): AdminPageFieldEditLinks->{closure}(Object(HookEvent))

This is Page.php, line 978 :
if(isset(PageProperties::$basePropertiesAlternates[$key])) {

By catching the exception, it appears that $key is an object, of type ProcessWire\PageField,
actually it's a Page Reference field.

As a temporary measure, if I add the condition
&& !is_object($key)
then the rendering succeeds (but I have no idea of the implications, in terms of access control etc)

Note : Same pattern & issue on line 1397 :
if($value !== null && isset($this->wakeupNameQueue[$key])) {

Setup/Environment

  • ProcessWire version: 3.0.203
  • PHP version: 8.0.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions