Problem/Motivation

When submitting a date range with an exposed filter in a View, after upgrading to Symfony 6, you may receive a message like this:

Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Input value "field_dates" contains a non-scalar value. in Symfony\Component\HttpKernel\HttpKernel->handle() (line 83 of /app/vendor/symfony/http-kernel/HttpKernel.php).

Steps to reproduce

Using a version of Drupal > 10, create a View with an exposed date filter on a smart_date_recur field. Set the filter operator to "Is between" so that the filter submits a [min] and [max] value. Upon submitting the form, you will see "A client error happened," and the above error message will appear in the logs.

Proposed resolution

As documented at https://stackoverflow.com/questions/77230889/how-do-i-fix-symfony-6-erro... , any occurrence of ->request->get($form_name) needs to be changed to ->request->all($form_name). The equivalent in Drupalese looks like \Drupal::request()->query->get($field_name). This code appears on line 163 of SmartDateRecurrenceFormatter.php. Changing it from get() to all() fixes the problem.

Remaining tasks

Make a fork and MR.

Issue fork smart_date-3414404

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

BenStallings created an issue. See original summary.

benstallings’s picture

Issue summary: View changes
benstallings’s picture

Issue summary: View changes

benstallings’s picture

Status: Active » Needs review

ready for review.

BenStallings changed the visibility of the branch 3414404-badrequesthttpexception-input-value to hidden.

benstallings’s picture

I'm not sure why I can't open a merge request, but here is the updated diff: https://git.drupalcode.org/issue/smart_date-3414404/-/commit/aa3d4f0711a...

mandclu’s picture

@BenStallings it looks like you already opened MR !78 on this issue.

benstallings’s picture

@mandclu yes, but it is botched. The MR contains nothing, and I can't figure out how to fix it, hence the patch.

mandclu’s picture

I believe I was able to get the change back into the MR. Do you know when the change was made in Symfony? I'm just wondering if this change requires dropping support for versions of Drupal before 10.

benstallings’s picture

@mandclu sorry, I have no idea when the change was made to Symfony.

mandclu’s picture

According to #3331874: $request->get may no longer return array as of Symfony 6.0 this is related to new behaviour in Symfony 6, so the updated behaviour will only work in D10 or newer, which is consistent which what was originally reported in the Issue Summary. We'll need to update the requirements accordingly.