Skip to content

Fix undefined method calls in Symfony 8#53

Closed
brpauwels wants to merge 1 commit into
klapaudius:5.1from
brpauwels:symfony8-request-get
Closed

Fix undefined method calls in Symfony 8#53
brpauwels wants to merge 1 commit into
klapaudius:5.1from
brpauwels:symfony8-request-get

Conversation

@brpauwels
Copy link
Copy Markdown

Call to undefined method Symfony\Component\HttpFoundation\Request::get()

```
Call to undefined method Symfony\Component\HttpFoundation\Request::get()
```
Copy link
Copy Markdown
Owner

@klapaudius klapaudius left a comment

Choose a reason for hiding this comment

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

Hello @brpauwels, thank you for your PR.

This fix is too restrictive,

Symfony 7.4 deprecated Request::get() method has this code :

    public function get(string $key, mixed $default = null): mixed
    {
        trigger_deprecation('symfony/http-foundation', '7.4', 'Request::get() is deprecated, use properties ->attributes, query or request directly instead.');

        if ($this !== $result = $this->attributes->get($key, $this)) {
            return $result;
        }

        if ($this->query->has($key)) {
            return $this->query->all()[$key];
        }

        if ($this->request->has($key)) {
            return $this->request->all()[$key];
        }

        return $default;
    }

We need to do the same.

klapaudius pushed a commit that referenced this pull request Mar 17, 2026
@klapaudius klapaudius self-assigned this Mar 17, 2026
@klapaudius
Copy link
Copy Markdown
Owner

I did the change to have the same behavior as Symfony 7.4. Thank you for your feedback.

I draft the new release now.

@klapaudius klapaudius closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants