InvalidArgumentException Error in Magento 2.3.5 is now solved

InvalidArgumentException Error In Magento
November 20, 2020
June 19, 2025

Magento is one of the maximum used platforms for forming E-commerce shopping stores. And behind that there is a strong reason for that!

The initiative taken by Adobe keeps on continuously releasing new versions from time to time in order to stay updated with the latest technology and increasing business needs. It is recommended that all users transform their Magento 2 stores to the latest version for applying the performance and security benefits.

However, while installing Magento 2.3.5 or its above versions, there is an error which might pop-up:

“InvalidArgumentException: Wrong file in m235\vendor\magento\framework\Image\Adapter\Gd2.php:64”

Here is the given solution for solving the error InvalidArgumentException error in Magento 2.3.5 or above version.
Solution for InvalidArgumentException Error in Magento 2.3.5 in Gd2.php:64

The below image shows the error that occurs while installing Magento 2.3.5.
The command prompt depicts the line 64. First open the file in the edit mode, then change the line 96 accordingly.

InvalidArgumentException Error in Magento 2.3.5 5





Open vendor\magento\framework\Image\Adapter\Gd2.php.
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;
  }

This is all about this error and its solution, if any questions persist then do ask here.

Thanking you

Related Posts