Problem/Motivation
1. I upgraded my Drupal 7 installation to version 7.x-2.32 of this module via web-interface.
2. When I tried to perform cron action using web-interface in different ways, I received blank pages.
3. Then I tried to do so with drush and here's the output:
u11309@ocean ~/domains/mydomain $ drush cron
PHP Parse error: syntax error, unexpected '[' in /home/u11309/domains/mydomain/sites/all/modules/advagg/advagg_js_compress/jshrink.inc on line 122
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: syntax error, unexpected '[' in /home/u11309/domains/mydomain/sites/all/modules/advagg/advagg_js_compress/jshrink.inc, line 122
4. As a temporary work-around I disabled AdvAgg Compress Javascript sub-module. That allowed me to run cron without errors
P.S. it is worth to mention that it's the first time I noticed any errors with this module. Previous updates (using same method) were totally fine.
Proposed resolution
Fixing the typo in sites/all/modules/advagg/advagg_js_compress/jshrink.inc
OR for those who are not familiar with PHP (like me), you can simply disable AdvAgg Compress Javascript
User interface changes
The only change was blank page at /admin/config/system/cron
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | advagg-2947925-11-test-all-files.patch | 579 bytes | mikeytown2 |
| #9 | advagg-2947925-9-fix-php53.patch | 489 bytes | mikeytown2 |
| #6 | advagg-2947925-6-unexpected-error.patch | 485 bytes | nitesh sethia |
Comments
Comment #2
pick_d commentedComment #3
mikeytown2 commentedLooks like an issue with older versions of php. I’ll get this fixed next week; patches welcome.
Comment #4
pick_d commentedWell, probably, yes. PHPinfo says it's version 5.3.29. And sorry, can't suggest any patch - not familiar with php :-(
Comment #5
nitesh sethia commentedSimply changing the code from protected $stringDelimiters = ['\'', '"', '`']; to protected $stringDelimiters = ["\'", '"', '`']; will fix the error.
Added a patch for the same.
Comment #6
nitesh sethia commentedSimply changing the code from
to
will fix the error.
Added a patch for the same.
Comment #7
mikeytown2 commented@Nitesh Sethia
That's not the correct fix here.
This is a bug due to the fact that in PHP 5.4 you can use short array syntax; but in php 5.3 it's not supported.
Comment #8
mikeytown2 commentedAlso the code change you did would have introduced a major bug into the jshrink code. See how your change makes the single quote into \'. That's bad.
Comment #9
mikeytown2 commentedThis should fix the error in php 5.3
Comment #11
mikeytown2 commentedThis should make sure that all files get php 5.3 tested.
Comment #13
mikeytown2 commented