Skip to content

Fixed deprecation happening when content type is checked in AppendAnalyticsListener #7186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

stollr
Copy link
Contributor

@stollr stollr commented Oct 20, 2023

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets -
Related issues/PRs -
License MIT
Documentation PR -

What's in this PR?

Setting default value in AppendAnalyticsListener when checking content type.

Why?

This is required, because the content type can be null (for example for responses with status code 204), which results in the following deprecation message:

strpos(): Passing null to parameter #1 () of type string is deprecated

in PHP 8.2

Example Usage

Add the following return statement to a controller action to reproduce the issue:

return $this->json(null, Response::HTTP_NO_CONTENT);

@alexander-schranz alexander-schranz added the Bug Error or unexpected behavior of already existing functionality label Oct 20, 2023
@alexander-schranz
Copy link
Member

alexander-schranz commented Oct 20, 2023

@stollr nice catch, can you rebase it to the 2.4 as there the deprecation should also be removed.

git rebase -i origin/2.6 --onto origin/2.4

@alexander-schranz alexander-schranz changed the base branch from 2.6 to 2.4 October 20, 2023 09:22
@stollr
Copy link
Contributor Author

stollr commented Oct 23, 2023

@alexander-schranz done ;-)

…t type

This is required, because the content type can be null (for example for responses with status code 204), which results in 'strpos(): Passing null to parameter sulu#1 () of type string is deprecated' in PHP 8.2
@alexander-schranz
Copy link
Member

@stollr Thank you!

@stollr stollr deleted the fix_strpos_null branch December 1, 2023 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error or unexpected behavior of already existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants