magento 2.4 windows平臺需要修改程式碼記錄

CyrusZhou發表於2020-10-27

1、vendor\magento\framework\View\Element\Template\File\Validator.php 

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

2、vendor\magento\framework\Image\Adapter\Gd2.php

    private function validateURLScheme(string $filename) : bool
    {
        $allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
        $url = parse_url($filename);
        //if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes)) {
        if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {    
            return false;
        }

        return true;
    }

 

注意:原始碼方式的檔案在lib\internal\Magento 下。

相關文章