xref: /PHP-8.2/sapi/cli/tests/bug68745.phpt (revision 13274912)
1--TEST--
2Bug #68745 (Invalid HTTP requests make web server segfault)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start('var_dump(count($_SERVER));', 'not-index.php');
11
12$host = PHP_CLI_SERVER_HOSTNAME;
13$fp = php_cli_server_connect();
14
15if(fwrite($fp, "GET www.example.com:80 HTTP/1.1\r\n\r\n")) {
16    while (!feof($fp)) {
17        echo fgets($fp);
18    }
19}
20
21fclose($fp);
22?>
23--EXPECTF--
24HTTP/1.1 200 OK
25Date: %s
26Connection: close
27X-Powered-By: %s
28Content-type: text/html; charset=UTF-8
29
30int(%d)
31