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. :)

CommentFileSizeAuthor
webform-php8-only-syntax.patch688 bytesjenlampton
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jenlampton created an issue. See original summary.

jenlampton’s picture

Issue summary: View changes
jenlampton’s picture

Issue summary: View changes
jenlampton’s picture

Issue summary: View changes
Liam Morland’s picture

Version: 7.x-4.25 » 7.x-4.x-dev

My 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.

Liam Morland’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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