Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
er314 opened this issue Aug 4, 2022 · 2 comments
Closed

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

er314 opened this issue Aug 4, 2022 · 2 comments

Comments

@er314
Copy link

er314 commented Aug 4, 2022

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
@JanRomero
Copy link

Hi, that error is caused by the module AdminPageFieldEditLinks and was fixed in this commit. Please download the current version of the module from AdminPageFieldEditLinks/releases . Unfortunately the version numbe was not incremented, that’s why ProcessWire does not find the new version in the module section.

@er314
Copy link
Author

er314 commented Aug 6, 2022

Ah yes, sorry, I forgot that AdminPageFieldEditLinks was a third-party module.
Thanks a lot for directly pointing to the root cause ; I confirm that the module update fixes the error.

@er314 er314 closed this as completed Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants