-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] PHP 8.1 deprecation notice in IpUtils::checkIp() #43350
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
Comments
Related to #41552 |
We should also deprecate passing |
Would you like to contribute a fix, @W0rma? |
Sure, I've just created #43357 to fix the deprecation warning and I will create additional PRs to deprecate/remove the possibility to pass |
fabpot
added a commit
that referenced
this issue
Oct 10, 2021
…ls::checkIp() (W0rma) This PR was merged into the 4.4 branch. Discussion ---------- [HttpFoundation] Fix PHP 8.1 deprecation notice in IpUtils::checkIp() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #43350 | License | MIT | Doc PR | After this PR got merged I will create additional PRs to deprecate (5.4)/remove (6.0) passing `null` to various methods in `IpUtils` like suggested in #43350 (comment) Commits ------- 5e991db Do not call substr_count() if ip is null to avoid deprecation warning in PHP 8.1
fabpot
added a commit
that referenced
this issue
Oct 16, 2021
…in IpUtils (W0rma) This PR was merged into the 5.4 branch. Discussion ---------- [HttpFoundation] Deprecate passing null as $requestIp in IpUtils | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | #43350 (comment) | License | MIT | Doc PR | Commits ------- 55e3a5b Deprecate passing null as $requestIp to IpUtils::checkIp(), checkIp4() and checkIp6()
fabpot
added a commit
that referenced
this issue
Oct 18, 2021
…equestIp in IpUtils (W0rma) This PR was merged into the 6.0 branch. Discussion ---------- [HttpFoundation] Remove possibility to pass null as $requestIp in IpUtils | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | #43350 (comment) | License | MIT | Doc PR | Removes the code which was deprecated in #43411 Commits ------- e95e97d Remove possibility to pass null as $requestIp in IpUtils
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected: 5.3
Description
I stumbled upon the method
IpUtils::checkIp()
:substr_count()
is called even if$requestIp === null
which causes a warning in PHP 8.1 ("substr_count(): Passing null to parameter #1 ($haystack) of type string is deprecated").How to reproduce
Possible Solution
I guess we could just avoid calling
substr_count()
if the request ip isnull
.Additional context
The text was updated successfully, but these errors were encountered: