Add new H5P activity results http 500 error in Moodle v3.9 - Class core_h5p\\file_storage contains 1 abstract method...

Using Moodle v3.9, mod_h5pactivity version 2020061500, PHP v7.4.33.
When I add new H5P activity into a course, it results http 500 error in Moodle v3.9.

After checking webserver logs, I see the following error:
PHP Fatal error:  Class core_h5p\\file_storage contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (H5PFileStorage::deleteLibrary) in /srv/www/moodle/htdocs/h5p/classes/file_storage.php on line 37, referer: https://mymoodle/course/view.php?id=123

Is this a bug?
Could be possible to fix this?

I also get this fatal error on Moodle cron log:

PHP Fatal error:  Declaration of core_h5p\file_storage::delete_library(array $library): void must be compatible with H5PFileStorage::delete_library($library) in /srv/www/moodle/htdocs/h5p/classes/file_storage.php on line 563

 

vishwakarmayojana's picture

This error occurs because the core_h5p\file_storage class in Moodle v3.9 does not fully implement the required H5PFileStorage methods, specifically deleteLibrary(). This could be due to an incompatibility between your Moodle version and the mod_h5pactivity plugin version.

Possible Fixes:

  1. Update Moodle – If possible, upgrade to a newer version, as Moodle 3.9 is quite outdated, and H5P has seen improvements in later versions.
  2. Check Plugin Version – Ensure that mod_h5pactivity is the correct version for Moodle 3.9. Try updating it to the latest compatible version.
  3. Manually Implement deleteLibrary() – If updating isn’t an option, you may need to modify /h5p/classes/file_storage.php and implement the missing method from H5P’s API.
  4. Switch PHP Version – If upgrading isn’t feasible, check whether PHP 7.4 is fully supported by Moodle 3.9 or if an earlier version (like PHP 7.3) works better.

If the issue persists, checking Moodle’s tracker or community forums for similar bug reports might help.

otacke's picture

Yeah, well, has that suggestion been generated by a LLM? :-)

The files in `h5p/classes` that throw the error are not part of the `mod_h5pactivity plugin`. Both work completely independently, so the plugin should not play a role at all here.

Moodle 3.9 shipped with h5plib/v124 that contains version 1.24 of H5P core. That combination is absolutely fine. And that version doesn't specify the `deleteLibrary` function in the interface. That was introduced in H5P core 1.26.

If I had to guess, then I'd say someone tried to run h5plib/v126 or h5plib/v127 on Moodle 3.9, probably to make newer content type versions work, and that would result in the error message.

But why should have to guess ... @klorinczi Could you please elaborate on your setup?