Explorar o código

Add workaround for PHP bug #61336

Jordi Boggiano %!s(int64=13) %!d(string=hai) anos
pai
achega
a4f9e03d35
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      src/Composer/Util/RemoteFilesystem.php

+ 5 - 0
src/Composer/Util/RemoteFilesystem.php

@@ -108,6 +108,11 @@ class RemoteFilesystem
             $result = @file_get_contents($fileUrl, false, $ctx);
         }
 
+        // fix for 5.4.0 https://bugs.php.net/bug.php?id=61336
+        if (!empty($http_response_header[0]) && preg_match('{^HTTP/\S+ 404}i', $http_response_header[0])) {
+            $result = false;
+        }
+
         // avoid overriding if content was loaded by a sub-call to get()
         if (null === $this->result) {
             $this->result = $result;