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";
12php_cli_server_start('require("syntax_error.php");');
13$dir = realpath(__DIR__);
14
15file_put_contents($dir . "/syntax_error.php", "<?php non_exists_function(); ?>");
16
17$output = '';
18$host = PHP_CLI_SERVER_HOSTNAME;
19$fp = php_cli_server_connect();
20
21if(fwrite($fp, <<<HEADER
22GET /index.php HTTP/1.1
23Host: {$host}
24
25
26HEADER
27)) {
28    while (!feof($fp)) {
29        $output .= fgets($fp);
30    }
31}
32echo $output;
33@unlink($dir . "/syntax_error.php");
34fclose($fp);
35?>
36--EXPECTF--
37HTTP/1.1 200 OK
38Host: %s
39Date: %s
40Connection: close
41X-Powered-By: PHP/%s
42Content-type: text/html; charset=UTF-8
43
44<br />
45<b>Fatal error</b>:  Uncaught Error: Call to undefined function non_exists_function() in %ssyntax_error.php:%d
46Stack trace:
47#0 %sindex.php(%d): require()
48#1 {main}
49  thrown in <b>%ssyntax_error.php</b> on line <b>%d</b><br />
50