bug61767.phpt 853 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Bug #61767 (Shutdown functions not called in certain error situation)
  3. --FILE--
  4. <?php
  5. set_error_handler(function($code, $msg, $file = null, $line = null) {
  6. echo "Error handler called ($msg)\n";
  7. throw new \ErrorException($msg, $code, 0, $file, $line);
  8. });
  9. register_shutdown_function(function(){
  10. echo "Shutting down\n";
  11. print_r(error_get_last());
  12. });
  13. //$undefined = null; // defined variable does not cause problems
  14. $undefined->foo();
  15. ?>
  16. --EXPECTF--
  17. Error handler called (Undefined variable $undefined)
  18. Fatal error: Uncaught ErrorException: Undefined variable $undefined in %sbug61767.php:%d
  19. Stack trace:
  20. #0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d)
  21. #1 {main}
  22. thrown in %sbug61767.php on line %d
  23. Shutting down
  24. Array
  25. (
  26. [type] => 1
  27. [message] => %a
  28. [file] => %sbug61767.php
  29. [line] => %d
  30. )