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 (ParseException $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
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8

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

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

HTTP/1.0 500 Internal Server Error
Host: localhost
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- Connection: close
004- X-Powered-By: %s
005- Content-type: text/html; charset=UTF-8
006- 
007- OK
008- HTTP/1.0 500 Internal Server Error
009- Host: localhost
010- Connection: close
011- X-Powered-By: %s
012- Content-type: text/html; charset=UTF-8
013- 
014- HTTP/1.0 500 Internal Server Error
015- Host: localhost
016- Connection: close
017- X-Powered-By: %s
018- Content-type: text/html; charset=UTF-8
019- 
020- HTTP/1.0 500 Internal Server Error
021- Host: localhost
022- Connection: close
023- X-Powered-By: %s
024- Content-type: text/html; charset=UTF-8

 

Generated at Thu, 21 May 2015 19:59:12 +0000 (4 days ago)

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