H5P Mods and compatibility with PHP 8

1791 Delegates's picture

Dear H5P Colleagues,

Our new server requires that we use PHP version 8.1.21. I'm writing to see if the two sets of plugin issues may be related to the H5P Mods plugin not being compatible with PHP 8.

ISSUE 1. UPDATE AVAILABLE NOT WORKING

We're unable to update the H5P Content Types, as shown here:

http://assets.1791delegates.org/v/S2qWaqroAN6Tmv2PreI7

ISSUE 2. FATAL ERROR 

Fatal error: Uncaught Error: implode(): Argument #2 ($array) must be of type ?array, string given
in /var/www/webroot/ROOT/wp-content/plugins/h5pmods-wordpress-plugin-master/h5pmods.php on line 231Call stack:
  1. implode()
    wp-content/plugins/h5pmods-wordpress-plugin-master/h5pmods.php:231
  2. find_semantics_path()
    wp-content/plugins/h5pmods-wordpress-plugin-master/h5pmods.php:220
  3. find_semantics_path()
    wp-content/plugins/h5pmods-wordpress-plugin-master/h5pmods.php:52
  4. h5pmods_alter_semantics()
    wp-includes/class-wp-hook.php:324
  5. WP_Hook::apply_filters()
    wp-includes/class-wp-hook.php:348
  6. WP_Hook::do_action()
    wp-includes/plugin.php:565
  7. do_action_ref_array()
    wp-content/plugins/h5p/public/class-h5p-wordpress.php:680
  8. H5PWordPress::alterLibrarySemantics()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:2509
  9. H5PCore::loadLibrarySemantics()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:4123
  10. H5PContentValidator::validateLibrary()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:4028
  11. H5PContentValidator::validateGroup()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:3871
  12. H5PContentValidator::validateList()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:4028
  13. H5PContentValidator::validateGroup()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:4028
  14. H5PContentValidator::validateGroup()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:4028
  15. H5PContentValidator::validateGroup()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:4134
  16. H5PContentValidator::validateLibrary()
    wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:2188
  17. H5PCore::filterParameters()
    wp-content/plugins/h5p/public/class-h5p-plugin.php:939
  18. H5P_Plugin::get_content_settings()
    wp-content/plugins/h5p/public/class-h5p-plugin.php:1033
  19. H5P_Plugin::add_assets()
    wp-content/plugins/h5p/public/class-h5p-plugin.php:925
  20. H5P_Plugin::shortcode()
    wp-includes/shortcodes.php:433
  21. do_shortcode_tag()
  22. preg_replace_callback()
    wp-includes/shortcodes.php:273
  23. do_shortcode()
    wp-content/plugins/elementor/includes/widgets/shortcode.php:130
  24. Elementor\Widget_Shortcode::render()
    wp-content/plugins/elementor/includes/base/controls-stack.php:2297
  25. Elementor\Controls_Stack::render_by_mode()
    wp-content/plugins/elementor/includes/base/widget-base.php:614
  26. Elementor\Widget_Base::render_content()
    wp-content/plugins/elementor/includes/base/widget-base.php:755
  27. Elementor\Widget_Base::print_content()
    wp-content/plugins/elementor/includes/base/element-base.php:464
  28. Elementor\Element_Base::print_element()
    wp-content/plugins/elementor/includes/base/element-base.php:1375
  29. Elementor\Element_Base::print_content()
    wp-content/plugins/elementor/includes/base/element-base.php:464
  30. Elementor\Element_Base::print_element()
    wp-content/plugins/elementor/includes/base/element-base.php:1375
  31. Elementor\Element_Base::print_content()
    wp-content/plugins/elementor/includes/base/element-base.php:464
  32. Elementor\Element_Base::print_element()
    wp-content/plugins/elementor/includes/base/element-base.php:1375
  33. Elementor\Element_Base::print_content()
    wp-content/plugins/elementor/includes/base/element-base.php:464
  34. Elementor\Element_Base::print_element()
    wp-content/plugins/elementor/includes/base/element-base.php:1375
  35. Elementor\Element_Base::print_content()
    wp-content/plugins/elementor/includes/base/element-base.php:464
  36. Elementor\Element_Base::print_element()
    wp-content/plugins/elementor/core/base/document.php:1749
  37. Elementor\C\B\Document::print_elements()
    wp-content/plugins/elementor/core/base/document.php:1144
  38. Elementor\C\B\Document::print_elements_with_wrapper()
    wp-content/plugins/elementor/includes/frontend.php:1179
  39. Elementor\Frontend::get_builder_content()
    wp-content/plugins/elementor/includes/frontend.php:1074
  40. Elementor\Frontend::apply_builder_in_content()
    wp-includes/class-wp-hook.php:324
  41. WP_Hook::apply_filters()
    wp-includes/plugin.php:205
  42. apply_filters()
    wp-includes/post-template.php:256
  43. the_content()
    wp-content/themes/buddyboss-theme/template-parts/content-sfwd.php:15
  44. require()
    wp-includes/template.php:792
  45. load_template()
    wp-includes/template.php:725
  46. locate_template()
    wp-includes/general-template.php:206
  47. get_template_part()
    wp-content/themes/buddyboss-theme/single-sfwd-lessons.php:27
  48. include()
    wp-includes/template-loader.php:106
  49. require_once()
    wp-blog-header.php:19
  50. require()
    index.php:17

Thank you for your assistance with these two issues. 

Thanks,

Nate

otacke's picture

Have you updated the plugin code since you installed it? Yes, I know it's not available in the WordPress plugin repository and that staying up-to-date requires an extra effort.

I think that the relevant code was changed in May 2022.

1791 Delegates's picture

Hi Otacke,

Thanks for confirming the code was changed in May 2022. Where can I go to find the updated plugin? When I go here https://github.com/h5p/h5pmods-wordpress-plugin/ I'm still only able to access version 0.0.1

Thanks,

Nate

otacke's picture

That is the updated version, but obviously the version number was never changed. You can simply change it to 0.0.2 or similar after downloading yourself.

BUT: WHEN INSTALLING THAT, YOU'D OVERWRITE ALL YOUR CHANGES, SO IT'S BETTER TO CHANGE THE CODE ON YOUR WORDPRESS INSTANCE DIRECTLY!

1791 Delegates's picture

Hi Otacke, 

Thanks for confirming that it's the updated version, but the version number never changed. That would explain why when I try uploading the updated version, I’m now seeing two plugins with the same version as seen here: number: 

See: http://assets.1791delegates.org/v/hhpEerStmapr36UrLg7g

Forgive me, but I don’t have the expertise to change the code directly or to change plugin version names. 

I welcome your expertise.

Thanks,
Nate

otacke's picture

Hi Nate!

You should not see the plugin twice - unless whoever customized it before renamed it (wisely). Could you reach out to that person?

Either way: All you should be required to do is to edit the h5pmods.php file inside the zip archive of the latest dowlonad. Line 17 holds the version number.

Best,
Oliver