Autoptimize fatal error: JSMin_UnterminatedStringException when HTML/inline-JS m
-
I’m hitting a hard 500 caused by Autoptimize’s inline-JS minifier choking on modern JS (template literals) that an ad vendor injects inline.
What breaks
- Request to a post URL returns 500 when Optimize HTML code → “minify inline JS” is enabled (and/or “aggregate inline JS”).
- The same URL loads fine with
?ao_noptimize=1or after disabling inline-JS minify.
Error (from Nginx/PHP-FPM logs)
PHP Fatal error: Uncaught JSMin_UnterminatedStringException: JSMin: Unterminated String at byte 65907: `,e),window.adthriveCLS&&(window.adthriveCLS.injectedFromPlugin=!1)}}));Ni()})(); in /wp-content/plugins/autoptimize/classes/external/php/jsmin.php:212 Stack trace: #0 /wp-content/plugins/autoptimize/classes/external/php/jsmin.php(150): JSMin->action(1) #1 /wp-content/plugins/autoptimize/classes/external/php/jsmin.php(84): JSMin->min() #2 /wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php(257): JSMin::minify('(function(){win...') #3 [internal function]: AO_Minify_HTML->_removeScriptCB(Array) #4 /wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php(108): preg_replace_callback('/(\s*)(<script\...', Array, '...HTML...')Suspected culprit
- Inline ad script referencing
window.adthriveCLS(Raptive/AdThrive CLS helper) contains ES6 backticks or otherwise confuses JSMin. - JSMin (the embedded PHP version) doesn’t fully support ES2015+ grammar, so it throws
UnterminatedStringExceptionon template literals/backticks.
You must be logged in to reply to this topic.