Решил переключиться на PHP 8.1 и получаю ошибку, вместо открытия сайта.
На PHP 8.0 та же ошибка.
Пропадает она, если ставлю версии 7.x.
Сама ошибка:
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
Кусок кода, где ошибка (2 строка):
$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];
}
}