You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
990 B

  1. --TEST--
  2. Bug #60523 (PHP Errors are not reported in browsers using built-in SAPI)
  3. --SKIPIF--
  4. <?php
  5. include "skipif.inc";
  6. ?>
  7. --INI--
  8. display_errors=1
  9. --FILE--
  10. <?php
  11. include "php_cli_server.inc";
  12. php_cli_server_start('require("syntax_error.php");');
  13. $dir = realpath(dirname(__FILE__));
  14. file_put_contents($dir . "/syntax_error.php", "<?php non_exists_function(); ?>");
  15. list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
  16. $port = intval($port)?:80;
  17. $output = '';
  18. $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
  19. if (!$fp) {
  20. die("connect failed");
  21. }
  22. if(fwrite($fp, <<<HEADER
  23. GET /index.php HTTP/1.1
  24. Host: {$host}
  25. HEADER
  26. )) {
  27. while (!feof($fp)) {
  28. $output .= fgets($fp);
  29. }
  30. }
  31. echo $output;
  32. @unlink($dir . "/syntax_error.php");
  33. fclose($fp);
  34. ?>
  35. --EXPECTF--
  36. HTTP/1.1 200 OK
  37. Host: %s
  38. Connection: close
  39. X-Powered-By: PHP/%s
  40. Content-type: text/html
  41. <br />
  42. <b>Fatal error</b>: Call to undefined function non_exists_function() in <b>%ssyntax_error.php</b> on line <b>%s</b><br />