8000 [HttpFoundation] IpUtils::checkIp4() should allow `/0` networks by zerkms · Pull Request #14690 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation] IpUtils::checkIp4() should allow /0 networks #14690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bug #14674 [HttpFoundation] Additional check that the network base IP…
… address is a valid IPv4
  • Loading branch information
zerkms committed May 19, 2015
commit 9cb4ccb02b76443b55c2020a0386df2df5281b5e
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/IpUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function checkIp4($requestIp, $ip)
}

if ($netmask === '0') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 === $netmask to keep consistency with other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dosten

'0' === $netmask then? (it's a string)

return true;
return filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
}
} else {
$address = $ip;
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function testIpv4Provider()
array(true, '192.168.1.1', array('192.168.1.0/24', '1.2.3.4/1')),
array(false, '192.168.1.1', array('1.2.3.4/1', '4.3.2.1/1')),
array(true, '1.2.3.4', '0.0.0.0/0'),
array(false, '1.2.3.4', '256.256.256/0'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example must be: array(false, '1.2.3.256', '0.0.0.0/0')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example must be: array(false, '1.2.3.256', '0.0.0.0/0')

I do not agree - it's not an IpValidation class

);
}

Expand Down
< 3881 /deferred-diff-lines>
0