Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Fixes BadRequestHttpException when following the documentation #361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ovski4
Copy link

@Ovski4 Ovski4 commented Mar 24, 2022

Hi,

I was trying to use this bundle with Symfony 6 but ended up with an error as soon as form filters were submitted.

Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Input value "item_filter" contains a non-scalar value.

Following the documentation, I found out the issue came from this line.

// manually bind values from the request
$form->submit($request->query->get($form->getName()));

Since Symfony passed version 6, retrieving non-scalar values using InputBag::get() will throw a BadRequestException. (See changelog here)

From the http foundation package documentation:

// don't use $request->query->get('foo'); use the following instead:
$request->query->all()['foo'];
// returns ['bar' => 'baz']

So this PR fixes the documentation accordingly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant