8000 preg_match PHP 8.1 deprecation in getProtocolVersion call on request from trusted proxy · Issue #44498 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

preg_match PHP 8.1 deprecation in getProtocolVersion call on request from trusted proxy #44498

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
Guuzen opened this issue Dec 7, 2021 · 2 comments

Comments

@Guuzen
Copy link
Guuzen commented Dec 7, 2021

Description

If there is no "Via" header then call will be deprecated because of null parameter for preg_match
This code branch executed (and deprecation triggered) only for requests from trusted proxies.

Deprecation message
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in vendor/symfony/http-foundation/Request.php on line 1518

@GromNaN
Copy link
Member
GromNaN commented Dec 7, 2021

Hello @Guuzen, thanks for reporting this issue. Can you provide a reproducer, ideally with a test case in RequestTest.

@Guuzen
Copy link
Author
Guuzen commented Dec 8, 2021

Sorry, maybe later. I am too lazy
But for anyone who more interested it is probably not very hard. You can try to add something like
'trusted with null via' => ['HTTP/2.0', true, null, 'HTTP/2.0'], dataset to protocolVersionProvider in RequestTest

@fabpot fabpot closed this as completed Dec 8, 2021
fabpot added a commit that referenced this issue Dec 8, 2021
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpFoundation] do not call preg_match() on null

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #44498
| License       | MIT
| Doc PR        |

Commits
-------

47298dc do not call preg_match() on null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0