Closed
Closed
Copy link
Description
Symfony version(s) affected
<=6.2
Description
If you provide a bad value to Request::create, its possible parse_url will fail to parse it settings $components to false. Later code doesn't handle the false condition which "works" because the last bit assigns a value to the variable converting it to an array. In PHP 8.1+ however this conversion behavior is deprecated.
How to reproduce
Request::create('/foo:123');
Outputs something like:
Deprecated function: Automatic conversion of false to array is deprecated in Symfony\Component\HttpFoundation\Request::create() (line 372 of /app/vendor/symfony/http-foundation/Request.php).
Symfony\Component\HttpFoundation\Request::create('/foo:123') ....
Possible Solution
The url isn't valid so it would probably be good to provide developer feedback but throwing an exception would be pretty disruptive.
Seems like the best approach might be:
- Explicitly handle the false condition preserving the current behavior. Include deprecation.
- Throw a InvalidArgument exception or similar in some future version.
Additional Context
No response