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

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

ignaciolflores created an issue. See original summary.

ignaciolflores’s picture

Status: Active » Needs review

Changes made don't affect tests on the project. I think that changes on MR28 can be reviewed.

mxr576’s picture

Changes made don't affect tests on the project. I think that changes on MR28 can be reviewed.

Indeed, 8.x-3.x fails on D10 testing, I have started a D9 build (just like on my issue) and it passed.

mxr576’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

Rajeshreeputra made their first commit to this issue’s fork.

rajeshreeputra’s picture

Issue tags: +ACMS2023
angheloko’s picture

StatusFileSize
new806 bytes

The patch in #1 doesn't work seem to work on D10, with Symfony 6, when filter is provided.

I'm attaching a new one, tested on a fresh D10 install.

angheloko’s picture

StatusFileSize
new808 bytes

Patch in #8 will fail when sort is scalar. Here's a new patch that supports both.

pfrenssen’s picture

jimsmith’s picture

This bug was preventing Gatsby Cloud from pulling content to run a new build. I tested patch #9 and it resolved the problem. Thank you, @angheloko!

mxr576’s picture

Hiden patch 8 because

Patch in #8 will fail when sort is scalar. Here's a new patch that supports both.

mxr576’s picture

Version: 8.x-3.23 » 8.x-3.x-dev
StatusFileSize
new681 bytes

Based on \Drupal\jsonapi\Controller\EntityResource::getJsonApiParams() #9 contains the proper fix and MR28 should be closed or the $request->query->all('filter') should be incorporated to the fix.

mxr576’s picture

bbrala’s picture

CI should be fixed again, so restarted a testjob.

bbrala’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the contribution. Great to have this working again.

  • bbrala committed 2b02cde4 on 8.x-3.x authored by mxr576
    Issue #3349731 by ignaciolflores, angheloko, mxr576, Rajeshreeputra,...

  • bbrala committed 2b02cde4 on feature/gitlab-ci authored by mxr576
    Issue #3349731 by ignaciolflores, angheloko, mxr576, Rajeshreeputra,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.