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.
Comment | File | Size | Author |
---|---|---|---|
#2 | php53compliant.patch | 1.56 KB | andyrandom |
Comments
Comment #2
andyrandom CreditAttribution: andyrandom commentedComment #4
icc CreditAttribution: icc commentedThis 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.
Comment #5
andyrandom CreditAttribution: andyrandom commentedI'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!