MDL-71706 core: use reflection to get directory of SCSS import.

This change is required to preserve existing validation of import
paths from a76b0b8b, since upgrading ScssPhp to 1.10.0.

See scssphp/scssphp@deba6fa4 for corresponding change that means
the current directory is no longer assumed when resolving paths.
This commit is contained in:
Paul Holden 2021-12-30 16:12:46 +00:00
parent bd854aa792
commit 944a68ae56
2 changed files with 7 additions and 2 deletions

View File

@ -161,7 +161,12 @@ class core_scss extends \ScssPhp\ScssPhp\Compiler {
list(, $rawpath) = $child;
$rawpath = $this->reduce($rawpath);
$path = $this->compileStringContent($rawpath);
if ($path = $this->findImport($path)) {
// We need to find the import path relative to the directory of the currently processed file.
$currentdirectory = new ReflectionProperty(\ScssPhp\ScssPhp\Compiler::class, 'currentDirectory');
$currentdirectory->setAccessible(true);
if ($path = $this->findImport($path, $currentdirectory->getValue($this))) {
if ($this->is_valid_file($path)) {
return parent::compileChild($child, $out);
} else {

View File

@ -222,7 +222,7 @@
<location>scssphp</location>
<name>scssphp</name>
<license>MIT</license>
<version>1.4.1</version>
<version>1.10.0</version>
</library>
<library>
<location>spout</location>