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:

When installing Magento 2.4 & getting below error

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

Error format as below

Solution: Find validateURLScheme function in vendor\magento\framework\Image\Adapter\Gd2.php file. at line 96. Replace function with this: !file_exists($filename)

Replace existing validateURLScheme function with modified validateURLScheme function as per below code

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;
  }

Finally, Magento 2.4 or 2.4.x Installation will be completed 100% after above changes

Other Important Magento 2.x Link

MAGENTO 2.4.5 released on 9th August, 2022 & Its Features


Magento 2.3 To Magento 2.4.5 Compatibility For PHP, MYSQL, Composer, Apache etc


Magento 2.4.3-p1 Installation Steps


Magento 2.4.3 Installation Steps


Magento 2.4.3 Features


Magento 2.4.3 – p1 Features


Magento 2.4 Two Factor Authentication


Magento 2.4.1 Features


Magento 2.4 Features


Magento 2.4 Installation


Magento 2.2, Magento 2.3, Magento2.4 Installation Issue on Windows 10, XAMPP


Magento 2 Installation at 51% Error: (Wrong file in Gd2.php:64) Module ‘Magento_Theme’


How To Upgrade Magento 2.4 To Magento 2.4.3 Enterprise-Edition / Commerce Cloud Edition


How To Upgrade Magento 2.4 To Magento 2.4.3 community-edition

Leave a Reply

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