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

Test Failure Report for sapi/cli/tests/bug43177.phpt ('Bug #61977 Test exit code for various errors')

Script

1: <?php
2:
include "php_cli_server.inc";
3:
php_cli_server_start(<<<'SCRIPT'
4:
    ini_set('display_errors', 0);
5:     switch($_SERVER["REQUEST_URI"]) {
6:             case "/parse":
7:                     try {
8:                         eval("this is a parse error");
9:                     } catch (ParseError $e) {
10:                     }
11:                     echo "OK\n";
12:                     break;
13:             case "/fatal":
14:                     eval("foo();");
15:                     echo "OK\n";
16:                     break;
17:             case "/compile":
18:                     eval("class foo { final private final function bar() {} }");
19:                     echo "OK\n";
20:                     break;
21:             case "/fatal2":
22:                     foo();
23:                     echo "OK\n";
24:                     break;
25:             default:
26:                     return false;
27:     }
28:
SCRIPT
29: );
30:
31: list(
$host$port) = explode(':'PHP_CLI_SERVER_ADDRESS);
32:
$port intval($port)?:80;
33:
34: foreach(array(
"parse""fatal""fatal2""compile") as $url) {
35:     
$fp fsockopen($host$port$errno$errstr0.5);
36:     if (!
$fp) {
37:           die(
"connect failed");
38:     }
39:
40:     if(
fwrite($fp, <<<HEADER
41:
GET /$url HTTP/1.1
42: Host: 
{$host}
43:
44:
45:
HEADER
46: )) {
47:         while (!
feof($fp)) {
48:                 echo 
fgets($fp);
49:         }
50:     }
51: }
52:
53:
?>
54:

Expected

HTTP/1.1 200 OK
Host: localhost
Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8

OK
HTTP/1.0 500 Internal Server Error
Host: localhost
Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8

HTTP/1.0 500 Internal Server Error
Host: localhost
Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8

HTTP/1.0 500 Internal Server Error
Host: localhost
Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8

Output

Warning: fsockopen(): unable to connect to localhost:8964 (Connection refused) in /var/php_gcov/PHP_HEAD/sapi/cli/tests/bug43177.php on line 35
connect failed

Diff

001+ Warning: fsockopen(): unable to connect to localhost:8964 (Connection refused) in /var/php_gcov/PHP_HEAD/sapi/cli/tests/bug43177.php on line 35
002+ connect failed
001- HTTP/1.1 200 OK
002- Host: localhost
003- Date: %s
004- Connection: close
005- X-Powered-By: %s
006- Content-type: text/html; charset=UTF-8
007- 
008- OK
009- HTTP/1.0 500 Internal Server Error
010- Host: localhost
011- Date: %s
012- Connection: close
013- X-Powered-By: %s
014- Content-type: text/html; charset=UTF-8
015- 
016- HTTP/1.0 500 Internal Server Error
017- Host: localhost
018- Date: %s
019- Connection: close
020- X-Powered-By: %s
021- Content-type: text/html; charset=UTF-8
022- 
023- HTTP/1.0 500 Internal Server Error
024- Host: localhost
025- Date: %s
026- Connection: close
027- X-Powered-By: %s
028- Content-type: text/html; charset=UTF-8

 

Generated at Tue, 26 Jul 2016 17:07:52 +0000 (3 days ago)

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