Annotation of embedaddon/php/sapi/cli/tests/bug43177.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #61977 Test exit code for various errors
! 3: --SKIPIF--
! 4: <?php
! 5: include "skipif.inc";
! 6: ?>
! 7: --FILE--
! 8: <?php
! 9: include "php_cli_server.inc";
! 10: php_cli_server_start(<<<'SCRIPT'
! 11: ini_set('display_errors', 0);
! 12: switch($_SERVER["REQUEST_URI"]) {
! 13: case "/parse":
! 14: eval("this is a parse error");
! 15: echo "OK\n";
! 16: break;
! 17: case "/fatal":
! 18: eval("foo();");
! 19: echo "OK\n";
! 20: break;
! 21: case "/compile":
! 22: eval("class foo { final private final function bar() {} }");
! 23: echo "OK\n";
! 24: break;
! 25: case "/fatal2":
! 26: foo();
! 27: echo "OK\n";
! 28: break;
! 29: default:
! 30: return false;
! 31: }
! 32: SCRIPT
! 33: );
! 34:
! 35: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
! 36: $port = intval($port)?:80;
! 37:
! 38: foreach(array("parse", "fatal", "fatal2", "compile") as $url) {
! 39: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
! 40: if (!$fp) {
! 41: die("connect failed");
! 42: }
! 43:
! 44: if(fwrite($fp, <<<HEADER
! 45: GET /$url HTTP/1.1
! 46: Host: {$host}
! 47:
! 48:
! 49: HEADER
! 50: )) {
! 51: while (!feof($fp)) {
! 52: echo fgets($fp);
! 53: }
! 54: }
! 55: }
! 56:
! 57: ?>
! 58: --EXPECTF--
! 59: HTTP/1.1 200 OK
! 60: Host: localhost
! 61: Connection: close
! 62: X-Powered-By: %s
! 63: Content-type: text/html
! 64:
! 65: OK
! 66: HTTP/1.0 500 Internal Server Error
! 67: Host: localhost
! 68: Connection: close
! 69: X-Powered-By: %s
! 70: Content-type: text/html
! 71:
! 72: HTTP/1.0 500 Internal Server Error
! 73: Host: localhost
! 74: Connection: close
! 75: X-Powered-By: %s
! 76: Content-type: text/html
! 77:
! 78: HTTP/1.0 500 Internal Server Error
! 79: Host: localhost
! 80: Connection: close
! 81: X-Powered-By: %s
! 82: Content-type: text/html
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>