diff options
| author | Stanislav Malyshev <stas@php.net> | 2013-01-01 21:20:35 -0800 |
|---|---|---|
| committer | Stanislav Malyshev <stas@php.net> | 2013-01-01 21:20:35 -0800 |
| commit | 80a9a80a52d1eb0281cd2894be05c685e4d526a0 (patch) | |
| tree | e9e3eafbe1e1000cba2c5ca90efd6c4c954fcbeb /sapi/cli/tests | |
| parent | 343a9199bbbf4f63b02099ceef27ef9881d8aa9f (diff) | |
| parent | 36e19c9cab6cce4e44782563f590c6c4560fb187 (diff) | |
| download | php-git-80a9a80a52d1eb0281cd2894be05c685e4d526a0.tar.gz | |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
Bug #43177: If an eval() has a parse error, the overall exit status and return code should not be affected.
fix NEWS
Conflicts:
main/main.c
Diffstat (limited to 'sapi/cli/tests')
| -rw-r--r-- | sapi/cli/tests/bug43177.phpt | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt new file mode 100644 index 0000000000..36b5504ab0 --- /dev/null +++ b/sapi/cli/tests/bug43177.phpt @@ -0,0 +1,82 @@ +--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": + eval("this is a parse error"); + 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 +); + +list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); +$port = intval($port)?:80; + +foreach(array("parse", "fatal", "fatal2", "compile") as $url) { + $fp = fsockopen($host, $port, $errno, $errstr, 0.5); + if (!$fp) { + die("connect failed"); + } + + 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 +Connection: close +X-Powered-By: %s +Content-type: text/html + +OK +HTTP/1.0 500 Internal Server Error +Host: localhost +Connection: close +X-Powered-By: %s +Content-type: text/html + +HTTP/1.0 500 Internal Server Error +Host: localhost +Connection: close +X-Powered-By: %s +Content-type: text/html + +HTTP/1.0 500 Internal Server Error +Host: localhost +Connection: close +X-Powered-By: %s +Content-type: text/html |
