Problem/Motivation
After updating to 7.x-4.25 my site immediately went whitescreen with nothing in the logs. When I attempted to run a drush up db
I got the following error:
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: syntax error, unexpected '[' in
/var/www/html/sites/all/modules/contrib/webform/includes/webform.conditionals.inc, line 1547
It appears that some PHP short array syntax snuck in here, as this line is using the array syntax []
, which does not work on my very old shared-hosting server (it appears to be running PHP 5.6).
$value = in_array($value, [0, NULL], TRUE) ? '' : $value;
should be
$value = in_array($value, array(0, NULL), TRUE) ? '' : $value;
If that change was intentional, a requirements check should be added -- so that people who are not yet running this version of know not to update to this version until they are. (I think short array syntax was added in PHP 5.4?)
If that was not intentional, patch attached. :)
Comment | File | Size | Author |
---|---|---|---|
webform-php8-only-syntax.patch | 688 bytes | jenlampton | |
Comments
Comment #2
jenlamptonComment #3
jenlamptonComment #4
jenlamptonComment #5
Liam MorlandMy tendency is to fix this by setting a minimum PHP version at PHP 5.6. I'm surprised people are still using PHP even that old.
Comment #7
Liam Morland