1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/standard/tests/general_functions/gh21018.phpt
Calvin Buckley cd32c597a7 Fix regression with header removal removing whole prefixes (#21020)
* Fix regression with header removing removing whole prefixes

The header removal code looked for the colon for key-value at the wrong
place, so it would overzealously remove headers. Tweak that condition,
and make the alternative condition only active if it's set (with the
remove prefix op case).

Fixes GH-21018.

* avoid reading past the actual length

* Rename variable to be more clear
2026-01-28 16:50:06 -04:00

22 lines
321 B
PHP

--TEST--
GH-21018 (header() removes headers with the same prefix)
--INI--
expose_php=On
--CGI--
--FILE--
<?php
header('a: 1');
header('a-test: 1');
header('a: 1');
var_dump(headers_list());
?>
--EXPECTF--
array(3) {
[0]=>
string(%d) "X-Powered-By: PHP/%s"
[1]=>
string(9) "a-test: 1"
[2]=>
string(4) "a: 1"
}