Problem/Motivation
See https://git.drupalcode.org/issue/jsonapi_extras-3563549/-/jobs/11983364 for a failing run.
The problem is
1) Drupal\Tests\jsonapi_extras\Kernel\EntityToJsonApiTest::testSerialize
PHPUnit\Framework\Exception: Uncaught PHP Exception TypeError: "str_contains(): Argument #1 ($haystack) must be of type string, null given" at /builds/issue/jsonapi_extras-3563549/web/core/modules/jsonapi/tests/modules/jsonapi_response_validator/src/EventSubscriber/ResourceResponseValidator.php line 69
2) Drupal\Tests\jsonapi_extras\Kernel\EntityToJsonApiTest::testRequestStack
PHPUnit\Framework\Exception: Uncaught PHP Exception TypeError: "str_contains(): Argument #1 ($haystack) must be of type string, null given" at /builds/issue/jsonapi_extras-3563549/web/core/modules/jsonapi/tests/modules/jsonapi_response_validator/src/EventSubscriber/ResourceResponseValidator.php line 69
ERRORS!
which is a problem in core.
See https://www.drupal.org/project/drupal/issues/3344629
Steps to reproduce
Proposed resolution
Can be closed without an MR if fixed upstream.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork jsonapi_extras-3621534
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
Comment #2
f0ns commentedAs described above the root cause is in core, not here.
HeaderBag::get()returnsNULLfor a header present with aNULLvalue, so the''default inResourceResponseValidatordoes not prevent theTypeError.Core MR: merge request 17048 (#3344629: Passing null to parameter #1 ($haystack) of type string is deprecated)
Note on scope: I could not reproduce this on
8.x-3.xHEAD. BothEntityToJsonApiTesttests pass there on core 11.4.5. It reproduces on the MR branch for #3563549: Missing config schema for field enhancers, which is what pipeline 11983364 ran.With the core fix applied, both tests pass: 88 assertions, previously 0.
Comment #3
bbralaI think the MR just needs a rebase. Seems to be fixed already in #3512041?
Comment #5
bbralaAdded a small test for regression possibilities on the EntityToJsonApi service.