After updating to the most recent version of H5P, all our H5P content views generated PHP errors that didn't log to the watchdog database. After checking the system logs, I discovered that h5p.classes.php uses short array syntax that isn't supported by PHP < 5.4. Our system is on 5.3, so the code crashed. Drupal coding guidelines state that

The use of PHP 5.4+ short array syntax for Drupal 8.x is being discussed and is used in some patches already. When used, try to apply it consistently to at least a whole method or function. Short array syntax should not be used in Drupal 7.x or 6.x core or contributed modules.

This patch removes the short array syntax and replaces it with PHP < 5.4 compliant code.

CommentFileSizeAuthor
#2 php53compliant.patch1.56 KBandyrandom
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andyrandom created an issue. See original summary.

andyrandom’s picture

FileSize
1.56 KB

  • andyrandom authored e683907 on 7.x-1.x
    Issue #2846766 by andyrandom: h5p.classes.php violates coding standards...
icc’s picture

Status: Active » Fixed

This was not by intent. I've applied and tested your patch before creating a new version of the plugin: 7.x-1.24
Apologies for any inconvenience this may have caused.

Thank you for reporting any providing a fix.

andyrandom’s picture

I'm sure you didn't do it on purpose! Most everybody using H5P is probably a little more up-to-date on PHP than our site. Thanks for fixing this so quickly!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.