Skip to content
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

Use zero instead of null as empty arg for header() for PHP 8.1+ compat #7452

Merged
merged 3 commits into from
Feb 6, 2023

Conversation

westonruter
Copy link
Member

See #7225 (comment)

See also docs for header(): https://www.php.net/manual/en/function.header.php

The $response_code parameter is define as follows:

Forces the HTTP response code to the specified value. Note that this parameter only has an effect if the header is not empty.

Note empty here. So 0 and null should work the same since they are both empty.

Note also the function signature:

header(string $header, bool $replace = true, int $response_code = 0): void

The default value of $response_code is 0.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2023

Plugin builds for e2f9c19 are ready 🛎️!

Copy link
Collaborator

@thelovekesh thelovekesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@westonruter westonruter merged commit e48e316 into develop Feb 6, 2023
@westonruter westonruter deleted the fix/header-function-empty-value branch February 6, 2023 20:40
@pavanpatil1 pavanpatil1 mentioned this pull request Feb 7, 2023
2 tasks
@pavanpatil1
Copy link

QA Passed ✅

Tested it with PHP v8.1 and 8.2, Deprecation warning is not visible now.

@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelogged Whether the issue/PR has been added to release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants