PHP  
 PHP_5_5
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for sapi/cli/tests/php_cli_server_013.phpt ('No router, no script')

Script

1: <?php
2:
include "php_cli_server.inc";
3:
php_cli_server_start(NULLTRUE);
4:
5: list(
$host$port) = explode(':'PHP_CLI_SERVER_ADDRESS);
6:
$port intval($port)?:80;
7:
$output '';
8:
9:
$fp fsockopen($host$port$errno$errstr0.5);
10: if (!
$fp) {
11:   die(
"connect failed");
12: }
13:
14:
15: if(
fwrite($fp, <<<HEADER
16:
POST / HTTP/1.1
17: Host: 
{$host}
18: Content-Type: application/x-www-form-urlencoded
19: Content-Length: 3
20:
21: a=b
22:
HEADER
23: )) {
24:     while (!
feof($fp)) {
25:         
$output .= fgets($fp);
26:     }
27: }
28:
29: echo 
preg_replace("/<style>(.*?)<\/style>/s""<style>AAA</style>"$output), "\n";
30:
fclose($fp);
31:
32:
33:
$output '';
34:
$fp fsockopen($host$port$errno$errstr0.5);
35: if (!
$fp) {
36:   die(
"connect failed");
37: }
38:
39: if(
fwrite($fp, <<<HEADER
40:
GET /main/style.css HTTP/1.1
41: Host: 
{$host}
42:
43:
44:
HEADER
45: )) {
46:     while (!
feof($fp)) {
47:         
$output .= fgets($fp);
48:     }
49: }
50:
51: echo 
preg_replace("/<style>(.*?)<\/style>/s""<style>AAA</style>"$output), "\n";
52:
fclose($fp);
53:
54:
$output '';
55:
$fp fsockopen($host$port$errno$errstr0.5);
56: if (!
$fp) {
57:   die(
"connect failed");
58: }
59:
60: if(
fwrite($fp, <<<HEADER
61:
HEAD /main/foo/bar HTTP/1.1
62: Host: 
{$host}
63:
64:
65:
HEADER
66: )) {
67:     while (!
feof($fp)) {
68:         
$output .= fgets($fp);
69:     }
70: }
71:
72: echo 
preg_replace("/<style>(.*?)<\/style>/s""<style>AAA</style>"$output), "\n";
73:
fclose($fp);
74:
?>
75:

Expected

HTTP/1.1 404 Not Found
Host: %s
Connection: close
Content-Type: text/html; charset=UTF-8
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">/</code> was not found on this server.</p></body></html>
HTTP/1.1 404 Not Found
Host: %s
Connection: close
Content-Type: text/html; charset=UTF-8
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/style.css</code> was not found on this server.</p></body></html>
HTTP/1.1 404 Not Found
Host: %s
Connection: close
Content-Type: text/html; charset=UTF-8
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/foo/bar</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_5_5/sapi/cli/tests/php_cli_server_013.php on line 9
connect failed

Diff

001+ Warning: fsockopen(): unable to connect to localhost:8964 (Connection refused) in /var/php_gcov/PHP_5_5/sapi/cli/tests/php_cli_server_013.php on line 9
002+ connect failed
001- HTTP/1.1 404 Not Found
002- Host: %s
003- Connection: close
004- Content-Type: text/html; charset=UTF-8
005- Content-Length: %d
006- 
007- <!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
008- </head><body><h1>Not Found</h1><p>The requested resource <code class="url">/</code> was not found on this server.</p></body></html>
009- HTTP/1.1 404 Not Found
010- Host: %s
011- Connection: close
012- Content-Type: text/html; charset=UTF-8
013- Content-Length: %d
014- 
015- <!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
016- </head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/style.css</code> was not found on this server.</p></body></html>
017- HTTP/1.1 404 Not Found
018- Host: %s
019- Connection: close
020- Content-Type: text/html; charset=UTF-8
021- Content-Length: %d
022- 
023- <!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
024- </head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/foo/bar</code> was not found on this server.</p></body></html>

 

Generated at Tue, 23 Sep 2014 16:38:04 +0000 (6 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.