php 8.4+ compatibility - css can fail unexpectedly

Xon

Well-known member
Affected version
2.3.9
I was recently updating a test site running on php 8.4.16, and some css pages started causing the following error:
Code:
Deprecated: Less_Functions::__construct(): Implicitly marking parameter $currentFileInfo as nullable is deprecated, the explicit nullable type must be used instead in .../src/vendor/oyejorge/less.php/lib/Less/Functions.php on line 12

It looks like the oyejorge/less.php library requires some patching:
Code:
class Less_Functions {

public $env;
public $currentFileInfo;

function __construct( $env, array $currentFileInfo = null ) {
$this->env = $env;
$this->currentFileInfo = $currentFileInfo;
    }

This should be ?array $currentFileInfo = null
 
Last edited:
I'v got 2 regex's which find hits;
Code:
\bfunction\b[^();]*\(([^),]*,)?\s*(?!mixed|null|\?)[\w\\]+(\s*\|\s*((?!null)[\w\\]+))*\s+(&\s*)?\$\w+\s*=\s*null\b

This one finds more false positives, but tends captures a few the above one doesn't;
Code:
function.*\([^\?\)]+\s*[\w]+\s*(&\s*)?\$[\w]+\s*=\s*null.*?\)
 
Back
Top Bottom