InvalidArgumentException: Expected a scalar value as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::get()", "array" given.

Created on 22 March 2023, over 1 year ago
Updated 31 August 2023, over 1 year ago

Problem/Motivation

I encounter the following error while calling an endpoint without params:

InvalidArgumentException: Expected a scalar value as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::get()", "array" given. in Symfony\Component\HttpFoundation\InputBag->get() (line 31 of /var/www/vendor/symfony/http-foundation/InputBag.php).

Steps to reproduce

  • Fresh Drupal 10 install with standard profile.
  • Add some articles.
  • Install JSON API Defaults and dependencies.
  • Call /jsonapi/node/article
  • Get a 500 error

Proposed resolution

In symfony 6, the InputBag::get() no longer accepts arrays as default values, so it needs to be change to something else (an empty string?).

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇪🇸Spain ignaciolflores

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

Comments & Activities

Production build 0.71.5 2024