1--TEST--
2Bug #60523 (PHP Errors are not reported in browsers using built-in SAPI)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--INI--
8display_errors=1
9--FILE--
10<?php
11include "php_cli_server.inc";
12$doc_root = php_cli_server_start('require("syntax_error.php");')->docRoot;
13
14file_put_contents($doc_root . "/syntax_error.php", "<?php non_exists_function(); ?>");
15
16$output = '';
17$host = PHP_CLI_SERVER_HOSTNAME;
18$fp = php_cli_server_connect();
19
20if(fwrite($fp, <<<HEADER
21GET /index.php HTTP/1.1
22Host: {$host}
23
24
25HEADER
26)) {
27    while (!feof($fp)) {
28        $output .= fgets($fp);
29    }
30}
31echo $output;
32@unlink($doc_root . "/syntax_error.php");
33fclose($fp);
34?>
35--EXPECTF--
36HTTP/1.1 200 OK
37Host: %s
38Date: %s
39Connection: close
40X-Powered-By: PHP/%s
41Content-type: text/html; charset=UTF-8
42
43<br />
44<b>Fatal error</b>:  Uncaught Error: Call to undefined function non_exists_function() in %ssyntax_error.php:%d
45Stack trace:
46#0 %sindex.php(%d): require()
47#1 {main}
48  thrown in <b>%ssyntax_error.php</b> on line <b>%d</b><br />
49