This would be a bug that addresses this commit. Author changed $path
to
$this->fileDriver->getRealPath($path)
which is simply calling realpath()
on $path
but that might change directory separators on the $path
that previously were affected by
#/vendor/magento/framework/View/Element/Template/File/Validator.php:114
$filename = str_replace('\', '/', $filename);
On a Windows OS this will revert changes of above str_replace
so that a path like
D:/Magento2.3/vendor/magento
will be canonicalized to its Windows specific version:
D:Magento2.3vendormagento
and this will not result in a successful comparison within isPathInDirectories()
method of MagentoFrameworkViewElementTemplateFileValidator
class:
foreach ($directories as $directory) {
if (0 === strpos($realPath, $directory)) {
return true;
}
}
Solution
Currently we can go for a dirty quick change in the above foreach
loop so that we can run our magento with no further problems on this:
#/vendor/magento/framework/View/Element/Template/File/Validator.php:139
foreach ($directories as $directory) {
// Add this line
$realDirectory = $this->fileDriver->getRealPath($directory);
// and replace `$directory` with `$realDirectory`
if (0 === strpos($realPath, $realDirectory)) {
return true;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…