Test Failure Report for sapi/cli/tests/bug68745.phpt ('Bug #68745 (Invalid HTTP requests make web server segfault)')
Script
1:
<?php 2: include "php_cli_server.inc"; 3: php_cli_server_start('var_dump(count($_SERVER));', 'not-index.php'); 4: 5: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); 6: $port = intval($port)?:80; 7: 8: $fp = fsockopen($host, $port, $errno, $errstr, 0.5); 9: if (!$fp) { 10: die("connect failed"); 11: } 12: 13: if(fwrite($fp, "GET www.example.com:80 HTTP/1.1\r\n\r\n")) { 14: while (!feof($fp)) { 15: echo fgets($fp); 16: } 17: } 18: 19: fclose($fp); 20: ?> 21:
Expected
HTTP/1.1 200 OK
Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
int(%d)
Output
Unable to connect to server
Diff
001+ Unable to connect to server
001- HTTP/1.1 200 OK
002- Date: %s
003- Connection: close
004- X-Powered-By: %s
005- Content-type: text/html; charset=UTF-8
006-
007- int(%d)
Generated at Sat, 21 Apr 2018 13:46:58 +0000 (45 hours ago)
|