Problem/Motivation

h5p-core v 1.28 has been released (found by composer at https://packagist.org/packages/h5p/h5p-core). When updating an existing site or installing the drupal h5p module for the first time, composer will select that version, which will cause the following error:

Fatal error: Class Drupal\h5p\H5PDrupal\H5PDrupal contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (H5PFrameworkInterface::resetHubOrganizationData) in /var/www/html/web/modules/contrib/h5p/src/H5PDrupal/H5PDrupal.php on line 12

Steps to reproduce

on a site that has never had the module installed:

  1. composer require drupal/h5p
  2. composer show h5p/h5p-core [to verify which version of the h5p code was installed]
  3. Enable the two modules: visit /admin/modules, filter by "h5p", enable "H5P" and "H5P Editor" (presumably you can also just enable with drush)
  4. Add an h5p field to a new or existing content type
  5. Attempt to create a node with that content type

There may be other orders of operation that encounter the same issue.

Proposed resolution

A similar thing happened when H5P Core 1.27 was released: Issue #3477835, which was deemed to have been a result of the 1.27 upgrade, as addressed in Issue #3497789.

Since the answer at that time was to stub out the missing method from the interface, I will attempt the same thing here.

Issue fork h5p-3578071

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ldpm created an issue. See original summary.

ldpm’s picture

Assigned: ldpm » Unassigned
Status: Active » Needs review

MR submitted

mreda’s picture

pjotr.savitski’s picture

This change gets things working again.

ryan-l-robinson’s picture

Patch seems to have fixed the problem for me as well.

ammaletu’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Shouldn't all the stub methods be filled with functionality at some point? But for what it's worth, the patch gets pages with H5P content from white-screen-of-death back to working. And since there are already four other stub methods, this won't hurt.

I'm taking the liberty to set this to RTBC as three people reviewed the patch now. Also, seeing how this completely breaks pages with H5P content, I'm setting the priority to Major. Merging this and tagging a new release would be preferable to everyone having to add a patch file.

As to the reason why this happened, twice: If the module implements an interface from h5p/h5p-core and this interface can change between version 1.27 and 1.28, then I think "^1.27" in composer is not sufficient. This should either be "^1.27.0" or "1.27". The module maintainers then should update the version manually, once they are sure that there are no breaking changes in the new h5p/h5p-core version.

ammaletu’s picture

This also seems to send cron runs into a loop. In production, where the patch is not yet enabled, I see more than one cron run per minute (instead of one every 20 minutes), never getting farther than the h5p_cron (obviously). So this can break sites which only have the module enabled, even if there is no H5P content.

chamilsanjeewa’s picture

This fixed the problem

c-logemann’s picture

Title: h5p-core update to 1.28 causing issue similar to update to 1.27 » resetHubOrganizationData since h5p-core 1.28

The module blocks cron run and can't even be uninstalled with this error. #4 patch tested and used in productive system to fix. So: RTBC +1

dkmishra’s picture

I can confirm this issue affects both install and uninstall on Drupal 11. Running either `drush en -y h5p` or `drush pmu h5p` results in the fatal error described above due to the missing `resetHubOrganizationData()` method.

Tested with Drupal 11.x, PHP 8.3, h5p/h5p-core 1.28.

After applying the #4 patch, both `drush en -y h5p` and `drush pmu h5p` complete successfully without errors. RTBC +1

frob’s picture

I think a better fix is, in composer.json change the h5p-core version requirement.

-    "h5p/h5p-core": "^1.27",
+    "h5p/h5p-core": "~1.27.0",