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
44Connection: close
45X-Powered-By: PHP/%s
46Content-type: text/html
47
48<br />
49<b>Fatal error</b>:  Call to undefined function non_exists_function() in <b>%ssyntax_error.php</b> on line <b>%s</b><br />
50