PHP error: Using ${var} in strings is deprecated

#1
Latest version of OpenLiteSpeed, I get this error:

PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /usr/local/lsws/share/autoindex/autoindex_include.php on line 482

I have had this with the last couple of versions too. Just changing the one line as suggested fixes it. This is with PHP 8.2
 
#3
Thank you for looking into this.

I have just done a few tests. It is nothing to do with web admin.

The error occurs if I view a URL with a .htaccess file that specifies PHP 8.2 (as below) and no index.php file, so the server returns a HTML list of the files and folders.

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} \.(php|phar)$
RewriteRule .* - [H=application/x-httpd-lsphp82]
It also only happens once, I can't get it to happen repeatedly. I assume this is due to the caching. It also does not happen with any other PHP version from 7.0 to 8.1.

In addition fixing the code as indicated by changing line 482 from
PHP:
echo "<div class=\"$echo "<div class=\"${style}\">\n" . htmlspecialchars($content, ENT_QUOTES | ENT_SUBSTITUTE) . "</div>\n";
to
PHP:
echo "<div class=\"$echo "<div class=\"{$style}\">\n" . htmlspecialchars($content, ENT_QUOTES | ENT_SUBSTITUTE) . "</div>\n";
does not cause any errors with any PHP versions from 7.0 to 8.2

I do not have any PHP 5.x versions installed so cannot comment or test on those. The eventual fix may need to use the updated line for newer PHP versions only.

Hopefully that helps.
Paul
 
Top