xref: /PHP-5.6/Zend/tests/bug61767.phpt (revision 29050975)
1--TEST--
2Bug #61767 (Shutdown functions not called in certain error situation)
3--FILE--
4<?php
5set_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
10register_shutdown_function(function(){
11    echo "Shutting down\n";
12    print_r(error_get_last());
13});
14
15//$undefined = null; // defined variable does not cause problems
16$undefined->foo();
17--EXPECTF--
18Error handler called (Undefined variable: undefined)
19
20Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: undefined' in %sbug61767.php:%d
21Stack trace:
22#0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d, Array)
23#1 {main}
24  thrown in %sbug61767.php on line %d
25Shutting down
26Array
27(
28    [type] => 1
29    [message] => %a
30    [file] => %sbug61767.php
31    [line] => %d
32)
33