php-src/sapi/cli/tests/php_cli_server_014.phpt
Ilija Tovilo d7d0d19d32
Support index.php fallback for files in built-in server
If no router script is used, the built-in webserver will now look for a fallback
index file recursively in all cases, including URLs with a period.

Fixes GH-12604
Closes GH-12992
2024-01-09 16:13:39 +01:00

71 lines
1.2 KiB
PHP

--TEST--
Bug #60477: Segfault after two multipart/form-data POST requests
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "php_cli_server.inc";
php_cli_server_start('echo "done\n";', null);
$output = '';
$host = PHP_CLI_SERVER_HOSTNAME;
$fp = php_cli_server_connect();
if(fwrite($fp, <<<HEADER
POST /index.php HTTP/1.1
Host: {$host}
Content-Type: multipart/form-data; boundary=---------123456789
Content-Length: 70
---------123456789
Content-Type: application/x-www-form-urlencoded
a=b
HEADER
)) {
while (!feof($fp)) {
$output .= fgets($fp);
}
}
fclose($fp);
$fp = php_cli_server_connect();
if(fwrite($fp, <<<HEADER
POST /main/no-exists.php HTTP/1.1
Host: {$host}
Content-Type: multipart/form-data; boundary=---------123456789
Content-Length: 70
---------123456789
Content-Type: application/x-www-form-urlencoded
a=b
HEADER
)) {
while (!feof($fp)) {
$output .= fgets($fp);
}
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
fclose($fp);
?>
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Date: %s
Connection: close
X-Powered-By: %s
Content-type: %s
done
HTTP/1.1 200 OK
Host: %s
Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: %s
done