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 *

πŸš€ Let’s Connect on LinkedIn! πŸš€

Want to level up your skills and knowledge? πŸš€
Follow us on LinkedIn to get:
βœ… Expert insights on business growth
βœ… Daily tips to sharpen your skills
βœ… Exclusive updates from The Coach SMB

Let's grow together!

Select your currency
USD United States (US) dollar