Issue #3344629 Fix TypeError when the Content-Type header is NULL

HeaderBag::get() returns its default only when the header is absent. A header present with a NULL value returns NULL, so the '' default does not stop a NULL reaching stripos() and str_contains(). Under PHP 8 that is a TypeError.

Fixed in ActiveLinkResponseFilter, RssResponseRelativeUrlFilter, and ResourceResponseValidator in the jsonapi_response_validator test module. Each now uses get('Content-Type') ?? '', without the redundant default.

Adds test coverage for a NULL Content-Type. Also corrects ActiveLinkResponseFilterTest::testOnlyHtml(), which called get() instead of set() and never tested a non-HTML response.

The test module breaks contributed testing, such as JSON:API Extras issue #3621534.

Generated with the help of an LLM.

Closes #3344629

Merge request reports

Loading