xref: /PHP-5.3/Zend/tests/bug61767.phpt (revision b29dc146)
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
20Warning: Uncaught exception 'ErrorException' with message 'Undefined variable: undefined' in %sbug61767.php:13
21Stack trace:
22#0 %sbug61767.php(13): {closure}(8, 'Undefined varia...', '%s', 13, Array)
23#1 {main}
24  thrown in %sbug61767.php on line 13
25
26Fatal error: Call to a member function foo() on a non-object in %sbug61767.php on line 13
27Shutting down
28Array
29(
30    [type] => 1
31    [message] => Call to a member function foo() on a non-object
32    [file] => %sbug61767.php
33    [line] => 13
34)
35