xref: /php-src/Zend/tests/bug61767.phpt (revision 08b2ab22)
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?>
18--EXPECTF--
19Error handler called (Undefined variable $undefined)
20
21Fatal error: Uncaught ErrorException: Undefined variable $undefined in %sbug61767.php:%d
22Stack trace:
23#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 13)
24#1 {main}
25  thrown in %sbug61767.php on line %d
26Shutting down
27Array
28(
29    [type] => 1
30    [message] => Uncaught ErrorException: Undefined variable $undefined in %s:%d
31Stack trace:
32#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 13)
33#1 {main}
34  thrown
35    [file] => %sbug61767.php
36    [line] => %d
37)
38