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
 
#8
FEI, the fix will be applied in the next release.
hello master @Cold-Egg today (again) we find this error in ours logs:
Code:
[27-Apr-2025 20:12:42 America/Bogota] PHP Warning:  opendir(): open_basedir restriction in effect. File(/usr/local/lsws/Example/html/.well-known/acme-challenge/) is not within the allowed path(s): (/home/MYWEBSITE.com/public_html) in /usr/local/lsws/share/autoindex/autoindex_include.php on line 311
[27-Apr-2025 20:12:42 America/Bogota] PHP Warning:  opendir(/usr/local/lsws/Example/html/.well-known/acme-challenge/): Failed to open directory: Operation not permitted in /usr/local/lsws/share/autoindex/autoindex_include.php on line 311
this is our LSWS:
Code:
[root@pepsi ~]# /usr/local/lsws/bin/lshttpd -v
LiteSpeed/1.8.3 Open (BUILD built: Fri Feb 28 16:33:02 UTC 2025)
        module versions:
        lsquic 4.2.0
        modgzip 1.1
        cache 1.66
        mod_security 1.4 (with libmodsecurity v3.0.13)

[root@pepsi ~]#
and this is our current server:
Code:
[root@pepsi ~]# more /etc/redhat-release
AlmaLinux release 9.5 (Teal Serval)
[root@pepsi ~]#
how we can PREVENT next errors with this "/usr/local/lsws/share/autoindex/autoindex_include.php"?
which is the TASK/PROPOSE of "/usr/local/lsws/share/autoindex/autoindex_include.php" ?
who active this file ?
why ?


THANKS masters :)
 
Top