diff vendor/symfony/http-foundation/IpUtils.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 7a779792577d
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/symfony/http-foundation/IpUtils.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/vendor/symfony/http-foundation/IpUtils.php	Mon Apr 23 09:46:53 2018 +0100
@@ -75,7 +75,7 @@
         if (false !== strpos($ip, '/')) {
             list($address, $netmask) = explode('/', $ip, 2);
 
-            if ($netmask === '0') {
+            if ('0' === $netmask) {
                 return self::$checkedIps[$cacheKey] = filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
             }
 
@@ -87,6 +87,10 @@
             $netmask = 32;
         }
 
+        if (false === ip2long($address)) {
+            return self::$checkedIps[$cacheKey] = false;
+        }
+
         return self::$checkedIps[$cacheKey] = 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask);
     }
 
@@ -119,6 +123,10 @@
         if (false !== strpos($ip, '/')) {
             list($address, $netmask) = explode('/', $ip, 2);
 
+            if ('0' === $netmask) {
+                return (bool) unpack('n*', @inet_pton($address));
+            }
+
             if ($netmask < 1 || $netmask > 128) {
                 return self::$checkedIps[$cacheKey] = false;
             }