Problem/Motivation
The version of JShrink included with 8.x-4.1 is broken when used with PHP 8 (https://github.com/tedious/JShrink/issues/96). It hangs because of a change made to the return value of substr(), eventually timing out depending on your maximum execution time.
Steps to reproduce
- install on a site using PHP 8
- choose the JShrink minifier
- watch the site either whitescreen or hang, depending on your server setup
Proposed resolution
Update JShrink to 1.4.0 or later.
Remaining tasks
Review patch.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 3252394screenshot.png | 120.29 KB | charginghawk |
| #2 | advagg-jshrink-update.3252394-1.patch | 33.35 KB | ksenzee |
Issue fork advagg-3252394
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ksenzeeI copied and pasted from https://github.com/tedious/JShrink/blob/v1.4.0/src/JShrink/Minifier.php, and put the codingstandards @ignores and license info at the top of the file back to what they were before. I'm not at all convinced this is the right way to include this library in 2021, but this patch will make JShrink stop whitescreening and actually work under PHP 8, so it's an improvement.
Comment #3
kburakozdemir commented#2 is working without any problem under PHP 8.0.13.
Comment #4
vasikei'm confirming the issue, BUT for PHP 7.4
and also that the patch ... put back the site "online"
Comment #5
boulaffasae commented+1 RTBC PHP 8.1
Comment #6
tetem commentedI have same issue with drupal 9 and PHP 8
Any potential solutions for fixing this problem?
Thanks.
Comment #7
bobooon commented+1 RTBC
Comment #8
heddnRTBC++
Comment #9
klaasvw commentedAnother + for RTBC, fixed a max_execution_time error on PHP 8.1 for us.
Comment #10
charginghawk commented+1 RTBC
Comment #11
eduardo morales alberti+1 RTBC PHP 8.1
Comment #12
akalam commented+1 RTBC
Comment #13
platinum1 commented+1 RTBC
Comment #14
tzt20 commented+1 RTBC
Comment #15
the.tai.pen@gmail.com commented+1 RTBC
Comment #16
joelpittetMoving to 5.0.0 version (but probably should have a branch)
Comment #19
fathima.asmat commented+1 RTBC. would be good to get this over to. anew release :)
Comment #20
Sivakumaran commentedI'm updated my site to PHP 8.0
Using drupal version of 7
Facing the same issue "Maximum execution time of 240 seconds exceeded"
Is there any patch available for D7 ?
Thanks in advance.
Comment #23
Thangaraj MoorthiDrupal version: 7.91
Advagg version: 7.x-2.35.
Recently i upgraded my site to PHP8.0
Now i am facing this same error: Maximum execution time of 240 seconds exceeded sites/all/modules/contrib/advagg/advagg_js_compress/jshrink.inc
Is there any fixes or patch available for advagg 7.x-2.35 ?
Comment #24
gisleFixes always goes to latest version (i.e. 5.0.x).
Based on comments #20 and #23, it shall need backport to Drupal 7.
Comment #25
Thangaraj MoorthiHey Guys,
Here is the patch form Drupal 7,
It'll be the fixes for "JShrink incompatible with PHP 8" and "Maximum execution time".
Thanks.
Comment #26
thallesIs the merge request in #18 the same as the patch in #2?
Comment #27
charginghawk commented@thalles They're the same. You can download the diff from the #18 commit here:
https://git.drupalcode.org/project/advagg/-/merge_requests/18
The diff between that and the patch is trivial:
Comment #28
ronino commented#25 fixed it for me on D7. Thanks a lot!
Comment #29
joelpittetHiding the D7 patch from #25 because it needs work but we need to get this into D9 before that and I don't want to have those patches conflate this issue or hold it up. The patch in #25 has too many short array syntax changes that are unneeded and would need a PHP requirement for Drupal 7. Maybe it would be worth creating a separate issue for this on D7?
Comment #30
saschaeggi+1 RTBC
Comment #31
joelpittetRegarding @ksenzee comment in #2, and for all D7 users it does already look for libraries, so you can add the v1.4.0 of this
tedivm/jshrinkPHP library to that directory in asites/all/libraries/jshrinkdirectory using composer (I'm using dealerdirect/phpcodesniffer-composer-installer composer plugin) or just copy the files there and it will load.So then you don't need this patch to be fixed in D7, but a project page note would help.
Comment #33
nickdickinsonwildeCommitted to 6.0.x, thanks everyone!
Comment #34
nickdickinsonwildeComment #36
dpagini commentedAny chance this can be backported to 5.x?