BadRequestHttpException: input value contains a non-scalar value

Created on 12 January 2024, 10 months ago
Updated 5 June 2024, 5 months ago

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.

πŸ› Bug report
Status

Needs review

Version

4.1

Component

Smart Date Recur

Created by

πŸ‡ΊπŸ‡ΈUnited States BenStallings

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024