Plugin SecurityInfo - deprecated php code

Hi,

I’ve just installed SecurityInfo plugin from MarketPlace.

Accessing the pluging page, I got this error message :

WARNING: /var/www/html/piwik/plugins/SecurityInfo/PhpSecInfo/Test/Test.php(383): Deprecated - Array and string offset access syntax with curly braces is deprecated - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: SecurityInfo, Action: index, In CLI mode: false)

I’m not very worried by this message but it indicates to report this message in the Matomo forums, so here it is :slight_smile: Hope it’s useful.

About soft versions :

Version de Matomo: 3.14.1
Version de MySQL: 10.1.19-MariaDB
Version de PHP: 7.4.10 

Hi,

The tips by the plugin are created by a really old library, so take them with a grain of salt.

I replaced that deprecated syntax last year, but it seems like no new version has been released (apart from the one for Matomo 4), so if you want to, you can manually apply the fix:

diff --git a/PhpSecInfo/Test/Test.php b/PhpSecInfo/Test/Test.php
index 289d3db..a3320e2 100644
--- a/PhpSecInfo/Test/Test.php
+++ b/PhpSecInfo/Test/Test.php
@@ -380,7 +380,7 @@ function returnBytes($val)
             return 0;
         }
 
-        $last = strtolower($val{strlen($val) - 1});
+        $last = strtolower($val[strlen($val) - 1]);
 
         if (is_string($last)) {
             $val = substr($val, 0, -1);

Thanks @Lukas for the tip, it works :slight_smile: