processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

RepeaterPage->getForField() throws warning if not Superuser and a lister is configured to show repeater templates

Open jlahijani opened this issue 2 months ago • 0 comments

Do the following to replicate this warning:

  • create a lister (can be listerpro) and under "What pages should a repeater show?" make it be a repeater_... template (create a repeater field if you don't have one already so you can select it here).
  • log in as a non-superuser and view the lister that was just created

You will get this warning:

Warning: Attempt to read property "name" on null in [.../modules/Fieldtype/FieldtypeRepeater/RepeaterPage.php:116]

I investigated it a bit and it's referring to this line in the getForField() method:

$grandparentName = $grandparent->name;

$grandparent is null. The ID of $this within that method is "999". 999 is not a real page; it's the test page that is used in the validateSelector method:

$testPage->id = 999; // required (any ID number works)

jlahijani avatar Oct 25 '25 15:10 jlahijani