Skip to content

Commit 922371f

Browse files
bukkaericnorris
andauthored
Do not send X-Powered-By if headers sent (#9039)
Co-authored-by: Eric Norris <erictnorris@gmail.com>
1 parent d8fc05c commit 922371f

File tree

3 files changed

+1
-5
lines changed

3 files changed

+1
-5
lines changed

main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@ zend_result php_request_startup(void)
17561756
CWDG(realpath_cache_size_limit) = 0;
17571757
}
17581758

1759-
if (PG(expose_php)) {
1759+
if (PG(expose_php) && !SG(headers_sent)) {
17601760
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
17611761
}
17621762

sapi/cgi/tests/bug69487.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,5 @@ var_dump(strlen(file_get_contents('php://input')));
1414
Warning: Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0
1515

1616
Warning: Unknown: POST data can't be buffered; all data discarded in Unknown on line 0
17-
18-
Warning: Cannot modify header information - headers already sent in Unknown on line 0
1917
bool(false)
2018
int(0)

tests/basic/025.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ var_dump($_POST, $HTTP_RAW_POST_DATA);
1313
--EXPECTF--
1414
Warning: Unknown: POST Content-Length of 2050 bytes exceeds the limit of 1024 bytes in Unknown on line 0
1515

16-
Warning: Cannot modify header information - headers already sent in Unknown on line 0
17-
1816
Warning: Undefined variable $HTTP_RAW_POST_DATA in %s on line %d
1917
array(0) {
2018
}

0 commit comments

Comments
 (0)