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

Request::create can trigger deprecated array conversion in 8.1 with bad values #47084

Copy link
Copy link
Closed
@neclimdul

Description

@neclimdul
Issue body actions

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:

  1. Explicitly handle the false condition preserving the current behavior. Include deprecation.
  2. Throw a InvalidArgument exception or similar in some future version.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.