Compatible with PHP 8.0, 8.1?

[ad_1]

Is the latest version of the plugin compatible with PHP 8.0, 8.1?

Plugin ver. 2.2.2 crash my site with PHP 8.1, fatal error.

___

Error in the file (line 602):

/autoptimize/classes/autoptimizeStyles.php

Text of error:

PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported in /public_html/wp-content/plugins/autoptimize/classes/autoptimizeStyles.php on line 602

Target code:

$url = $noQurl;
if ( '/' === $url{0} || preg_match( '#^(https?://|ftp://|data:)#i', $url ) ) {
  // URL is protocol-relative, host-relative or something we don't touch
  continue;
} else {
  // Relative URL
  $newurl = preg_replace( '/https?:/', '', str_replace( ' ', '%20', AUTOPTIMIZE_WP_ROOT_URL . str_replace( '//', '/', $dir . '/' . $url ) ) );

  // Hash the url + whatever was behind potentially for replacement
  // We must do this, or different css classes referencing the same bg image (but
  // different parts of it, say, in sprites and such) loose their stuff...
  $hash = md5( $url . $matches[2][$k] );
  $code = str_replace( $matches[0][$k], $hash, $code );

  if ( $removedQuotes ) {
    $replace[$hash] = "url('" . $newurl . "')" . $matches[2][$k];
  } else {
    $replace[$hash] = 'url(' . $newurl . ')' . $matches[2][$k];
  }
}
  • This topic was modified 1 hour, 22 minutes ago by kirpich1.
  • This topic was modified 1 hour, 22 minutes ago by kirpich1.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer