8000
We read every piece of feedback, and take your input very seriously.
1 parent 16eeebc commit 99465b1Copy full SHA for 99465b1
src/Symfony/Component/HttpFoundation/IpUtils.php
@@ -64,9 +64,13 @@ public static function checkIp4($requestIp, $ip)
64
if (false !== strpos($ip, '/')) {
65
list($address, $netmask) = explode('/', $ip, 2);
66
67
- if ($netmask < 1 || $netmask > 32) {
+ if ($netmask < 0 || $netmask > 32) {
68
return false;
69
}
70
+
71
+ if ($netmask === '0') {
72
+ return true;
73
+ }
74
} else {
75
$address = $ip;
76
$netmask = 32;
src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
@@ -34,6 +34,7 @@ public function testIpv4Provider()
34
array(true, '192.168.1.1', array('1.2.3.4/1', '192.168.1.0/24')),
35
array(true, '192.168.1.1', array('192.168.1.0/24', '1.2.3.4/1')),
36
array(false, '192.168.1.1', array('1.2.3.4/1', '4.3.2.1/1')),
37
+ array(true, '1.2.3.4', '0.0.0.0/0'),
38
);
39
40