Blog

Solved:- Parse error: syntax error, unexpected single-quoted string “/”, expecting “)” in Validator.php on line 141 Magento2

In this article, we are going to resolve the error:-

Parse error: syntax error, unexpected single-quoted string “/”, expecting “)” in vendor\magento\framework\View\Element\Template\File\Validator.php on line 141

Solution:-

In order to make the code work on windows instead of using realpath just use the $path argument passed to the method

Go to path vendor/magento/framework/View/Element/Template/File/Validator.php and instead of the line

if (0 === strpos($realPath, $directory)) {

use

if (0 === strpos($path, $directory)) {

 

Save the file.

That’s it.

Leave a Reply

Your email address will not be published. Required fields are marked *