Search
Other Advanced Module Manager questions
Forum

PHP 8 breaks functionality

Chris Paschen's Avatar Chris Paschen
We just upgraded a Joomla 3.10.11 site from PHP 7.x to PHP 8.0.25.

This appears to break AMM and has several modules, which were set to display on different days/times all appearing on the page all the time.

We're seeing '0 Undefined constant "N"' appear in the browser tab title.

And getting alerts from akeeba admin:
A PHP Exception occurred on your site. Here you can find the stack trace:

Exception Type: Error
File: /var/www/vhosts/---domain---/httpdocs/tmp/regularlabs/22358_dd9da9ec553d3073236a3c14ca519de7
Line: 9
Message: Undefined constant "N"

(and those notices are being sent every time there is a hit on the home page - where the problematic assigned modules appear).

I've disabled the related modules, but the notice is still appearing.

Any ideas what might be causing this?
Chris Paschen's Avatar Chris Paschen
We finally found the issue.

We had one module on the home page that was using a PHP custom code restriction controlling display of the module.
The PHP code was using a php function where the syntax had changed slightly and PHP8 no longer supported the old syntax.

After fixing the PHP code, it all works fine.
Peter van Westen's Avatar Peter van Westen ADMIN
Yup.

The next version of Advanced Module Manager will store the temporary PHP files used for custom PHP conditions in:
.../tmp/regularlabs/custom_php/
That should give a bit more of a clue where the problem comes from.
Please post a rating at the Joomla! Extensions Directory
Chris Paschen's Avatar Chris Paschen
Will that allow us to directly edit the file (using our own IDE), rather than in the GUI/Joomla Admin?
If so, that would be a wonderful feature.
Peter van Westen's Avatar Peter van Westen ADMIN
No, that is just the folder of the temporary PHP files.

But if you want to have your PHP code in an external file, you can do that and include it via the PHP condition.

Something like:
require_once JPATH_SITE . '/my_custom_files/my-special-file.php';

return mySpecialFunction();
Where mySpecialFunction is in that external file and returns a true or false value.
Please post a rating at the Joomla! Extensions Directory
Chris Paschen's Avatar Chris Paschen
Thanks for that tip. Somehow I missed that.
I'm guessing if I had used that I would have avoided this entire thing, because my IDE would have caught the PHP8-breaking code.

Thanks again for all the great extensions.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription