Skip to content

Do not send X-Powered-By if headers sent #9039

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
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,7 @@ zend_result php_request_startup(void)
CWDG(realpath_cache_size_limit) = 0;
}

if (PG(expose_php)) {
if (PG(expose_php) && !SG(headers_sent)) {
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
}

Expand Down
2 changes: 0 additions & 2 deletions sapi/cgi/tests/bug69487.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ var_dump(strlen(file_get_contents('php://input')));
Warning: Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0

Warning: Unknown: POST data can't be buffered; all data discarded in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0
bool(false)
int(0)
2 changes: 0 additions & 2 deletions tests/basic/025.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ var_dump($_POST, $HTTP_RAW_POST_DATA);
--EXPECTF--
Warning: Unknown: POST Content-Length of 2050 bytes exceeds the limit of 1024 bytes in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0

Warning: Undefined variable $HTTP_RAW_POST_DATA in %s on line %d
array(0) {
}
Expand Down