Page MenuHomePhabricator

Less_Exception_Compiler: error evaluating function `color` argument must be a string
Closed, ResolvedPublic

Description

PHP Deprecated: preg_replace(): Passing null to parameter #2 ($replacement) of type array|string is deprecated in .../less.php/lib/Less/Functions.php on line 538
PHP Fatal error:  Uncaught Less_Exception_Compiler: argument must be a string in .../less.php/lib/Less/Functions.php:776
Stack trace:
#0 .../less.php/lib/Less/Tree/Call.php(84): Less_Functions->color(Object(Less_Tree_Color))
#1 .../less.php/lib/Less/Tree/Expression.php(46): Less_Tree_Call->compile(Object(Less_Environment))
#2 .../less.php/lib/Less/Tree/Value.php(25): Less_Tree_Expression->compile(Object(Less_Environment))
#3 .../less.php/lib/Less/Tree/Rule.php(82): Less_Tree_Value->compile(Object(Less_Environment))
#4 .../less.php/lib/Less/Tree/Ruleset.php(96): Less_Tree_Rule->compile(Object(Less_Environment))
#5 .../less.php/lib/Less/Tree/Ruleset.php(96): Less_Tree_Ruleset->compile(Object(Less_Environment))
#6.../less.php/lib/Less/Parser.php(182): Less_Tree_Ruleset->compile(Object(Less_Environment))
#7 .../less.php/bin/lessc(189): Less_Parser->getCss()
#8 {main}

Next Less_Exception_Compiler: error evaluating function color argument must be a string index: 4342 in test.less on line 124, column 2
122| color-quoted-digit: color("#dda0dd");
123| color-quoted-keyword: color("plum");
124| color-color: color(#dda0dd);
125| color-keyword: color(plum);
126| tint: tint(#777777, 13);
127| tint-full: tint(#777777, 100); in .../less.php/lib/Less/Tree/Call.php:88

On Line 124, the Color function is called without quotes to signify the argument being passed is a string, and this is causing an error...

Less.Js expects this to pass, so we need to implement this functionality in Less.php

Event Timeline

Krinkle triaged this task as Medium priority.Jan 5 2024, 4:25 PM

Change 989229 had a related patch set uploaded (by Hokwelum; author: Hokwelum):

[mediawiki/libs/less.php@master] [Bug] Color argument must be a string

https://gerrit.wikimedia.org/r/989229

Change 989229 abandoned by Hokwelum:

[mediawiki/libs/less.php@master] [Bug] Color argument must be a string

Reason:

https://gerrit.wikimedia.org/r/989229

Change 989916 had a related patch set uploaded (by Hokwelum; author: Hokwelum):

[mediawiki/libs/less.php@master] Fix Color argument must be a string

https://gerrit.wikimedia.org/r/989916

Change 989916 merged by jenkins-bot:

[mediawiki/libs/less.php@master] Less_Functions: Fix unquoted passed to `color()`

https://gerrit.wikimedia.org/r/989916