mirror of
https://github.com/php/php-src.git
synced 2026-04-08 00:22:52 +02:00
The built-in Webserver's `on_path`, `on_query_string` and `on_url` callbacks may be called multiple times from the parser; we must not simply replace the old values, but need to concatenate the new values instead. This appears to be tricky for `on_path` due to the path normalization, so we fail if the function is called again. The built-in Webserver logs errors during request parsing to stderr, but this is ignored by the php_cli_server framework, and apparently the Webserver does not send a resonse at all in such cases (instead of an 4xx). Thus we can only check that a request with an overly long path fails. Closes GH-7207.
26 lines
643 B
PHP
26 lines
643 B
PHP
--TEST--
|
|
Bug #73630 (Built-in Weberver - overwrite $_SERVER['request_uri'])
|
|
--DESCRIPTION--
|
|
Check that too long paths result in invalid request
|
|
--SKIPIF--
|
|
<?php
|
|
include "skipif.inc";
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$code = <<<'EOF'
|
|
echo "won't happen\n";
|
|
EOF;
|
|
|
|
include "php_cli_server.inc";
|
|
php_cli_server_start($code);
|
|
|
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
|
$fp = php_cli_server_connect();
|
|
$path = "/" . str_repeat("x", 16400) . "//example.com";
|
|
var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "$path"));
|
|
?>
|
|
--EXPECTF--
|
|
Warning: file_get_contents(http://%s//example.com): failed to open stream: HTTP request failed! in %s on line %d
|
|
bool(false)
|