bug71005.phpt 614 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Bug #71005 (Segfault in php_cli_server_dispatch_router())
  3. --SKIPIF--
  4. <?php
  5. include "skipif.inc";
  6. ?>
  7. --FILE--
  8. <?php
  9. $code = <<<'EOF'
  10. set_exception_handler(function () { echo 'goodbye'; });
  11. throw new Exception;
  12. EOF;
  13. include "php_cli_server.inc";
  14. php_cli_server_start($code);
  15. $host = PHP_CLI_SERVER_HOSTNAME;
  16. $fp = php_cli_server_connect();
  17. if(fwrite($fp, <<<HEADER
  18. GET / HTTP/1.1
  19. Host: {$host}
  20. HEADER
  21. )) {
  22. while (!feof($fp)) {
  23. echo fgets($fp);
  24. }
  25. }
  26. ?>
  27. --EXPECTF--
  28. HTTP/1.1 200 OK
  29. Host: %s
  30. Date: %s
  31. Connection: close
  32. X-Powered-By: PHP/%s
  33. Content-type: text/html; charset=UTF-8
  34. goodbye