Page MenuHomePhabricator

Fix Undefined property: Less_Tree_Color::$value
Closed, ResolvedPublic

Description

Fix "@@" if the intermediary value resembles color keyword.

To reproduce the error, try compiling a less file that looks like so:

.color-keyword {
	@red: 'hello';
	@name: red;
	name: @@name;
}

you get an error similar to this:

PHP Warning:  Undefined property: Less_Tree_Color::$value in .../less.php/lib/Less/Tree/Variable.php on line 31

Warning: Undefined property: Less_Tree_Color::$value in .../less.php/lib/Less/Tree/Variable.php on line 31
PHP Fatal error:  Uncaught Less_Exception_Compiler: variable @ is undefined in file .../less.php/test.less in test.less on line 4, column 8
2| 	@red: 'hello';
3| 	@name: red;
4| 	name: @@name;
5| }
6|  .../less.php/lib/Less/Tree/Variable.php:50

**Stack trace:**
#0 ...less.php/lib/Less/Tree/Expression.php(46): Less_Tree_Variable->compile(Object(Less_Environment))
#1 .../less.php/lib/Less/Tree/Value.php(25): Less_Tree_Expression->compile(Object(Less_Environment))
#2 ../less.php/lib/Less/Tree/Rule.php(82): Less_Tree_Value->compile(Object(Less_Environment))
#3 ../less.php/lib/Less/Tree/Ruleset.php(96): Less_Tree_Rule->compile(Object(Less_Environment))
#4 .../less.php/lib/Less/Tree/Ruleset.php(96): Less_Tree_Ruleset->compile(Object(Less_Environment))
#5 .../less.php/lib/Less/Parser.php(182): Less_Tree_Ruleset->compile(Object(Less_Environment))
#6.../less.php/bin/lessc(189): Less_Parser->getCss()
#7 {main}
  thrown in .../less.php/lib/Less/Tree/Variable.php on line 50

The error only occurs if @@ intermediary value looks like a color.

Event Timeline

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

[mediawiki/libs/less.php@master] Fix Undefined property: Color::$value

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

Krinkle triaged this task as Medium priority.

Change 981308 merged by jenkins-bot:

[mediawiki/libs/less.php@master] Less_Tree_Color: Fix "Undefined property" warning for $value

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