Page MenuHomePhabricator

Less parser should detect if @import'ed less file doesn't exist
Closed, ResolvedPublic

Description

Follows-up https://gerrit.wikimedia.org/r/#/c/151441/1.

When the Less compiler encounters @import non-existent.less it left and silently skipped (it gets included in the outputted CSS even).

Confirmed by adding a bogus @import to screen.less in the Vector skin repository and (while installed in MediaWiki) running (mediawiki/tests/phpunit)$ php phpunit.php suites/LessTestSuite.php. It passes anyway.

Upon inspection, the return value of $compiler->compileFile( $this->file ) (in LessFileCompilationTest::testLessFileCompilation) is the expected CSS result with the bogus @import non-existent.less still in there.

This should result in a Less parse error and/or a test failure on our side at least.

Event Timeline

Krinkle created this task.Dec 2 2014, 4:41 AM
Krinkle updated the task description. (Show Details)
Krinkle raised the priority of this task from to Needs Triage.
Krinkle changed Security from none to None.
Krinkle added subscribers: Krinkle, matmarex, ori and 2 others.
hashar removed a subscriber: hashar.Dec 2 2014, 11:09 AM
Aklapper triaged this task as Low priority.Dec 3 2014, 5:27 PM
matmarex closed this task as Resolved.Sep 27 2016, 6:07 PM

This has been fixed by switching to oyejorge/less.php (T486). Attempting to @import a non-existent file now results in:

Less_Exception_Parser from line 2616 of /var/www/html/w/vendor/oyejorge/less.php/lib/Less/Parser.php: File `herpderp.less` not found. in screen.less