small bug in inline JS breaking Autoptimize
-
Hiya colleague developers;
There is a very small bug in the inline JS you are adding which breaks the Autoptimization (if Autoptimize’s non-default “also aggregate inline JS” option is active);In wp-content/plugins/super-socializer/super-socializer.php on line 842 you have;
<script type="text/javascript">var theChampDefaultLang = '<?php echo get_locale(); ?>', theChampCloseIconPath = '<?php echo plugins_url('images/close.png', __FILE__) ?>';<?php if(isset($theChampGeneralOptions["browser_msg_enable"]) && $theChampGeneralOptions["browser_msg"] != ""){ ?>var heateorSsSDKBlockedMsg = `<?php echo str_replace("{support_url}", "<a href=\'https://support.heateor.com/browser-blocking-social-features/\' target=\'_blank\' style=\'color:#33a9d8\'>https://support.heateor.com/browser-blocking-social-features/</a>", nl2br(htmlspecialchars($theChampGeneralOptions["browser_msg"], ENT_QUOTES))); ?>`<?php } ?></script>
but it should be
<script type="text/javascript">var theChampDefaultLang = '<?php echo get_locale(); ?>', theChampCloseIconPath = '<?php echo plugins_url('images/close.png', __FILE__) ?>';<?php if(isset($theChampGeneralOptions["browser_msg_enable"]) && $theChampGeneralOptions["browser_msg"] != ""){ ?>var heateorSsSDKBlockedMsg = '<?php echo str_replace("{support_url}", "<a href=\'https://support.heateor.com/browser-blocking-social-features/\' target=\'_blank\' style=\'color:#33a9d8\'>https://support.heateor.com/browser-blocking-social-features/</a>", nl2br(htmlspecialchars($theChampGeneralOptions["browser_msg"], ENT_QUOTES))); ?>'<?php } ?></script>
The difference is _very_ small (closing with ‘ instead of `) but it makes a huge difference to the JS optimizer that Autoptimize uses, as with ` it throws this nasty error;
PHP Fatal error: Uncaught JSMin_UnterminatedStringException: JSMin: Unterminated String at byte 456: ‘https://support.heateor.com/browser-blocking-social-features/\\’ target=\\’_blank\\’ style=\\’color:#33a9d8\\’>https://support.heateor.com/browser-blocking-social-features/ to unblock these.
Hope you can fix this soon (I guess the comma before
theChampCloseIconPath
has to be a semi-colon too, but I’ll leave that up to you)?have a nice day!
frank
- The topic ‘small bug in inline JS breaking Autoptimize’ is closed to new replies.