Undefined variable $pae

Can anyone shed a light on what is causing the error message. I have upgraded a perfectly working site to version 9.2.2 on PHP 8.1 and this appears to have broken my ‘News’ composer pages and so I now see the attached error message when attempting to post, view or edit a news page.

I have noticed that within the composer ‘Page Type’ set up page you can no longer see or select a page template under the Allowed Page Templates section.

That’s a bug, in php 8 you need to declare variables so you could just add

$pae = '':

At the top of the file and it should fix it

You should post a bug report on GitHub

I’m narrowed in on the fix as we speak. I’m not certain why it may fail all the conditions, but if it does, it’s undefined. Without being able to recreate though, I’m not so certain…

You probably also will have to check that whatever is calling that method checks the returned value is an object before using it.

I have managed a work around to solve the issue for now. That was to switch back to PHP 7.4 which stopped the error message. Then delete the composer control blocks on my News page type and then re-apply them and save. Everything currently seems ok now but obviously there is a bug which I have reported on Git.

That was my quick solution as well but I cannot figure out why the error gets triggered sometimes and not other times. I have one user of about 25 that cannot edit one page of the site (throws the error) but as far as I can see, there’s nothing in the permission structure that makes this user unique from the others. I gave up troubleshooting and just added the code above. It only started happening after upgrading to 9.2.2 from 9.2.1.

A recent upgrade to PHP 8.x caused a few custom packages to start throwing errors. I haven’t circled back to look at why this works, but what I found is that I had to change instances of:

if (!is_object($my_object))


if (!isset($my_object) || !is_object($my_object))

These checks were done just prior to hitting a foreach() to determine if there were any elements of my_object to loop over. The first if() worked perfectly well prior to PHP v8.

This has been fixed in 9.2.3