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
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3349731-9-inputbag-scalar.patch | 808 bytes | angheloko |
Issue fork jsonapi_extras-3349731
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:
- 3349731-invalidargumentexception-expected-a
changes, plain diff MR !28
Comments
Comment #3
ignaciolflores commentedChanges made don't affect tests on the project. I think that changes on MR28 can be reviewed.
Comment #4
mxr576Indeed, 8.x-3.x fails on D10 testing, I have started a D9 build (just like on my issue) and it passed.
Comment #5
mxr576Looks good to me.
Comment #7
rajeshreeputraComment #8
angheloko commentedThe patch in #1 doesn't work seem to work on D10, with Symfony 6, when
filteris provided.I'm attaching a new one, tested on a fresh D10 install.
Comment #9
angheloko commentedPatch in #8 will fail when
sortis scalar. Here's a new patch that supports both.Comment #10
pfrenssenComment #11
jimsmith commentedThis 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!
Comment #12
mxr576Hiden patch 8 because
Comment #13
mxr576Based 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.Comment #14
mxr576Comment #15
bbralaCI should be fixed again, so restarted a testjob.
Comment #16
bbralaThanks for the contribution. Great to have this working again.