Hi Stephen –
When updating sites to PHP 8.0+ we’re seeing that we get Critical Error on any front end pages including the FES shortcode output, and in the block editor where a post has that shortcode:
PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/www/vhosts/itc-arts.pooka.dev/httpdocs/wp-content/plugins/event-organiser-fes/includes/functions.php:200
Are you planning to bring the extension up to date for PHP 8.0+?
Best for now
Marcus
Pooka & Co
Hi Marcus,
This isn’t a PHP 8 incompatibility as such. The exception is being thrown because the plugin is attempting to set a property of the ‘form’ object/array, however, for some reason in your case its a string not an object.
The value being manipulated is retrieved from the post meta table with key ‘_event_form’ and post ID corresponding to the ID set in the shortcode attribute. If you run the following query (replacing X with the form ID) you should see a serialised array
SELECT meta_value FROM wp_postmeta WHERE meta_key="_event_form" AND post_id=X;
If it is in deed a string then something has corrupted it. If it isn’t, then I wonder if something could be accidentally modifying the value via a filter. In either case, though, I would also expect the form to not render correctly in the form builder.
I’ll improve the error handling to prevent the fatal error, but it won’t fix the underlying problem.
Stephen Harris
Hi Stephen – Thanks for the super speedy reply.
Yes, that sounds right. I had originally added the FES shortcode in the Gutenberg editor on WP on PHP 8.0 when I saw the Critical Error (on a fresh install of WP/EC/EC FEC with a few other plugins). Switching back to PHP 7.4 resolved the error, so I assumed it was a PHP version error. But then, I was able to switch back to PHP 8.0 and even 8.1 and it remained working. So, not sure what was getting corrupted originally, but the PHP version change seemed to resolve it.
Hope life is treating you well!
Marcus
Pooka & Co