Jump to content

1.4.4.1 PHP 5.2 dependency


Recommended Posts

Just noticed that the latest version 1.4.4.1 release requires PHP 5.2.x or higher. Just a heads up for anyone who moves from a test server running 5.2 to a production server running an earlier version.....

 

This dependency can be removed by replacing the Tools::packJSinHTML() function with one from an older 1.4 version.

 

Alternatively you could use this replacement:

 

public static function packJSinHTML($html_content)
   {
       if (strlen($html_content) > 0)
       {
           $htmlContentCopy = $html_content;
           $html_content = preg_replace_callback(
               '/\\s*(<script\\b[^>]*?>)([\\s\\S]*?)(<\\/script>)\\s*/i'
               ,array('Tools', 'packJSinHTMLpregCallback')
               ,$html_content);

           // If the string is too big preg_replace return an error
           // In this case, we don't compress the content
           //if ( preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR ) {
	    if (!$html_content) {
               error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML');
               return $htmlContentCopy;
           }
           return $html_content;
       }
       return false;
   }

 

Paul

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...