Deprecation notices with PHP 8.1+
-
I would like to report some deprecation warnings in this plugin when using PHP 8.1 and 8.2. They all come from the one file admin/colour/lessc.inc.php. A proper fix might be to update to a newer version of that file. See here: https://github.com/leafo/lessphp/issues/660
I try to keep my error log clean so I can discover and fix actual errors. With that in mind, since I am not sure whether this plugin is being actively maintained, here are the error log notices and the quick fixes I made to silence them.
Notice in PHP 8.1+:
PHP Deprecated: Implicit conversion from float 43026.0703125 to int loses precision in /wp-content/plugins/aquila-admin-theme/admin/colour/lessc.inc.php on line 1480
A quick
intval()
added to line?1480 takes care of it:$t = intval($num) % $width;
Notice in PHP 8.1+:
PHP Deprecated: preg_match(): Passing null to parameter #4 ($flags) of type int is deprecated in /wp-content/plugins/aquila-admin-theme/admin/colour/lessc.inc.php on line 3401
Changing the
null
to0
in lines?3401 solved it, and the same situation is also in lines?3413 and 3432.Several notices of this type in occur in PHP 8.2:
Creation of dynamic property lessc::$formatterName is deprecated in /wp-content/plugins/aquila-admin-theme/admin/colour/lessc.inc.php on line 1949
I suppose the properties should be explicitly declared, but I just silenced the error by putting
#[\AllowDynamicProperties]
above the class definition at line?40.
- The topic ‘Deprecation notices with PHP 8.1+’ is closed to new replies.