Test Failure Report for sapi/cli/tests/php_cli_server_014.phpt ('Bug #60477: Segfault after two multipart/form-data POST requestes')
Script
1:
<?php 2: include "php_cli_server.inc"; 3: php_cli_server_start('echo done, "\n";', TRUE); 4: 5: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); 6: $port = intval($port)?:80; 7: $output = ''; 8: 9: // note: select() on Windows (& some other platforms) has historical issues with 10: // timeouts less than 1000 millis(0.5). it may be better to increase these 11: // timeouts to 1000 millis(1.0) (fsockopen eventually calls select()). 12: // see articles like: http://support.microsoft.com/kb/257821 13: $fp = fsockopen($host, $port, $errno, $errstr, 0.5); 14: if (!$fp) { 15: die("connect failed"); 16: } 17: 18: if(fwrite($fp, <<<HEADER 19: POST /index.php HTTP/1.1 20: Host: {$host} 21: Content-Type: multipart/form-data; boundary=---------123456789 22: Content-Length: 70 23: 24: ---------123456789 25: Content-Type: application/x-www-form-urlencoded 26: a=b 27: HEADER 28: )) { 29: while (!feof($fp)) { 30: $output .= fgets($fp); 31: } 32: } 33: 34: fclose($fp); 35: 36: $fp = fsockopen($host, $port, $errno, $errstr, 0.5); 37: if(fwrite($fp, <<<HEADER 38: POST /main/no-exists.php HTTP/1.1 39: Host: {$host} 40: Content-Type: multipart/form-data; boundary=---------123456789 41: Content-Length: 70 42: 43: ---------123456789 44: Content-Type: application/x-www-form-urlencoded 45: a=b 46: HEADER 47: )) { 48: while (!feof($fp)) { 49: $output .= fgets($fp); 50: } 51: } 52: 53: echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n"; 54: fclose($fp); 55: 56: ?> 57:
Expected
HTTP/1.1 200 OK
Host: %s
Connection: close
X-Powered-By: %s
Content-type: %s
done
HTTP/1.1 404 Not Found
Host: %s
Connection: close
Content-Type: %s
Content-Length: %d
<!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/no-exists.php</code> was not found on this server.</p></body></html>
Output
Warning: fsockopen(): unable to connect to localhost:8964 (Connection refused) in /var/php_gcov/PHP_HEAD/sapi/cli/tests/php_cli_server_014.php on line 13
connect failed
Diff
001+ Warning: fsockopen(): unable to connect to localhost:8964 (Connection refused) in /var/php_gcov/PHP_HEAD/sapi/cli/tests/php_cli_server_014.php on line 13
002+ connect failed
001- HTTP/1.1 200 OK
002- Host: %s
003- Connection: close
004- X-Powered-By: %s
005- Content-type: %s
006-
007- done
008- HTTP/1.1 404 Not Found
009- Host: %s
010- Connection: close
011- Content-Type: %s
012- Content-Length: %d
013-
014- <!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
015- </head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/no-exists.php</code> was not found on this server.</p></body></html>
Generated at Fri, 17 May 2013 23:23:52 +0000 (4 days ago)
|