mirror of
https://github.com/php/php-src.git
synced 2026-04-18 05:21:02 +02:00
The sizeof()s for Content-Length and Transfer-Encoding were missing the trailing ":". Apart from being generally wrong, this no longer verified that the header actually contains a colon, leading to the null http_header_value being used. Additionally, in the interest of being defensive, also make sure that http_header_value is non-null by setting it to the end of the header line (effectively an empty string) if there is no colon. If the following conditions are correct, this value is not going to be used though.
32 lines
637 B
PHP
32 lines
637 B
PHP
--TEST--
|
|
Bug #75535: Inappropriately parsing HTTP response leads to PHP segment fault
|
|
--SKIPIF--
|
|
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:22351'); ?>
|
|
--INI--
|
|
allow_url_fopen=1
|
|
--FILE--
|
|
<?php
|
|
require 'server.inc';
|
|
|
|
$responses = array(
|
|
"data://text/plain,HTTP/1.0 200 Ok\r\nContent-Length\r\n",
|
|
);
|
|
|
|
$pid = http_server("tcp://127.0.0.1:22351", $responses, $output);
|
|
|
|
var_dump(file_get_contents('http://127.0.0.1:22351/'));
|
|
var_dump($http_response_header);
|
|
|
|
http_server_kill($pid);
|
|
?>
|
|
==DONE==
|
|
--EXPECT--
|
|
string(0) ""
|
|
array(2) {
|
|
[0]=>
|
|
string(15) "HTTP/1.0 200 Ok"
|
|
[1]=>
|
|
string(14) "Content-Length"
|
|
}
|
|
==DONE==
|