Explorar o código

Detect failed gethostbyname, refs #2449

Jordi Boggiano %!s(int64=11) %!d(string=hai) anos
pai
achega
730dcbb80a
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/Composer/Util/NoProxyPattern.php

+ 3 - 0
src/Composer/Util/NoProxyPattern.php

@@ -73,6 +73,9 @@ class NoProxyPattern
                 if (strpos($ruleHost, '/') === false) {
                     $match = $ip === $ruleHost;
                 } else {
+                    if ($ip === $host) {
+                        throw new \RuntimeException('gethostbyname() failed to resolve "'.$host.'" to an IP, can not evaluate NO_PROXY rules');
+                    }
                     $match = self::inCIDRBlock($ruleHost, $ip);
                 }
             } else {