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