Problem/Motivation
Admin users are unable to log in, and this shows up in the error logs:
PHP Parse error: syntax error, unexpected '.', expecting ',' or ';' in /var/www/drupal/ssu-7.73-20201112/sites/all/modules/contrib/siteimprove/includes/SiteimproveUtils.php on line 13
Steps to reproduce
Install and enable siteimprove, and log in as a user with admin access.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3183031_php54_parse_error.diff | 1.21 KB | beltofte |
Comments
Comment #2
beltofteHi Eric,
I have tried to reproduce the issue in a local Docker environment with latest version of Drupal 7 and on both PHP 7.2, 7.3 and 7.4 and can't reproduce the error. There are no syntax errors in SiteimproveUtils.php when looking in code stored in Drupal.org git. See https://git.drupalcode.org/project/siteimprove/-/blob/7.x-1.2/includes/SiteimproveUtils.php#L13
Please share some more details about your environment? Which PHP version are you using?
Please, also check that you are on version 7.x-1.2 of Siteimprove module and if not then please upgrade to the latest version.
Best regards,
jens
Comment #3
freiheit commentedThis is Drupal 7.74 and PHP 5.4.16 on CentOS 7.9. Siteimprove version is 7.x-1.2.
(we've since updated drupal to 7.75, but rest is the same versions)
Comment #4
beltofteThanks @freiheit. Looks like the issue is related to constant expression not supported by PHP before version 5.6 if I'm not wrong.
Is it possible that you can test the attached patch on PHP 5.4?
Comment #5
craigra commentedI had the same syntax error on PHP 5.4.40. The patch in #4 fixed the error for me.
Comment #7
bartvig commentedFixed in latest dev version.
Comment #8
bartvig commentedForget my previous comment, that was for Drupal 8.
Comment #10
bartvig commentedAnd now fixed for version 7.x-1.x.