magento2 [2020-11-02 20:11:03] main.CRITICAL: Invalid template file code example

Example: Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file:

> protected function isPathInDirectories($path, $directories) {
>     if (!is_array($directories)) {
>         $directories = (array)$directories;
>     }
>     $realPath = $this->fileDriver->getRealPath($path);
>     $realPath = str_replace('\\', '/', $realPath); // extra code added
>     foreach ($directories as $directory) {
>         if (0 === strpos($realPath, $directory)) {
>             return true;
>         }
>     }
>     return false; }

Tags:

Php Example