Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[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
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] Changed comparison to yoda-style for cons…
…istency purposes
  • Loading branch information
zerkms committed May 19, 2015
commit aa240838c10ce708c3008d8329b209733c362f0e
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/HttpFoundation/IpUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function checkIp4($requestIp, $ip)
return false;
}

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

Choose a reason for hiding this comment

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

The only address allowed to have a /0 netmask is 0.0.0.0. So this check must be: 0 === $netmask && '0.0.0.0' === $address. Please don't cast 0 as string, do 0, don't '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.

@dosten I do not cast anything - it's a string initially, please look carefully at the code

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, cast is not the word :) i say: 0 === $netmask instead of '0' === $netmask

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 you cannot do that, $netmask is a string

return filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
}
} else {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.