summaryrefslogtreecommitdiff
path: root/sapi/cli/tests/bug43177.phpt
blob: 6c734e476ab4db30bd4b7d133ae1f0c6e00e1461 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--TEST--
Bug #61977 Test exit code for various errors
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "php_cli_server.inc";
php_cli_server_start(<<<'SCRIPT'
    ini_set('display_errors', 0);
    switch($_SERVER["REQUEST_URI"]) {
            case "/parse":
                    try {
                        eval("this is a parse error");
                    } catch (ParseError $e) {
                    }
                    echo "OK\n";
                    break;
            case "/fatal":
                    eval("foo();");
                    echo "OK\n";
                    break;
            case "/compile":
                    eval("class foo { final private final function bar() {} }");
                    echo "OK\n";
                    break;
            case "/fatal2":
                    foo();
                    echo "OK\n";
                    break;
            default:
                    return false;
    }
SCRIPT
);

$host = PHP_CLI_SERVER_HOSTNAME;

foreach(array("parse", "fatal", "fatal2", "compile") as $url) {
    $fp = php_cli_server_connect();
    if(fwrite($fp, <<<HEADER
GET /$url HTTP/1.1
Host: {$host}


HEADER
)) {
        while (!feof($fp)) {
                echo fgets($fp);
        }
    }
}

?>
--EXPECTF--
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