PHP 8.1 Conflict (H5P WordPress Plugin)
Submitted by zachconnolly on Thu, 12/15/2022 - 19:40
The H5P WordPress plugin seems to conflict with PHP 8.1 and causes a fatal error when viewing rendered modules due to an array being passed to the property_exists() function.
Detailed steps to reproduce the bug:
- Install H5P WordPress plugin (v1.15.6) on a WP site running PHP 8.1
- Attempt to preview any H5P content by clicking the title of a module on the wp-admin page H5P > All H5P Content
Platform and version number:
WordPress 6.1.1
H5P plugin version:
1.15.6
Any PHP errors:
PHP Fatal error: Uncaught TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given in /var/www/webroot/ROOT/wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:4037
Casting the $group varialble on line 4037 of /wp-content/plugins/h5p/h5p-php-library/h5p.classes.php to an object seems to fix it:
if (! property_exists( (object) $group, $field->name)) {
Content types:
papi Jo
Thu, 12/15/2022 - 22:33
Permalink
Hi there!
Here's my setup:
localhost on Windows with Wampserver
PHP 8.1
WordPress 6.1.1
H5P plugin version: 1.15.6 (just updated today)
No problem at all. Are you experiencing the problem with specific H5P contents?