Magento – Magento 2.3.5 error gd2.php on installation

magento2magento2.3.5

While installing Magento 2.3.5 in windows, I got this Error:

[Progress: 698 / 1369]
Module 'Magento_Theme':

In PatchApplier.php line 170:

Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme. Original exception message: Wrong file

In Gd2.php line 64:

Wrong file

Best Answer

I found a workaround for Windows OS. Image Adapter try opens to image files ('open function in Gd2.php line 63). validateURLScheme function return false always because it checking 'URL' format but local files not valid for this format, so it returns false.

Find validateURLScheme function in vendor\magento\framework\Image\Adapter\Gd2.php file. at line 96. Replace function with this:

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) && !file_exists($filename)) {
              return false;
          }

          return true;   
}
Related Topic