xref: /php-src/Zend/tests/gh13446_3.phpt (revision 3301d960)
1--TEST--
2GH-13446: Exception handler isn't restored if it is previously modified
3--FILE--
4<?php
5function exception_handler_1($ex) {
6    echo "Handler 1\n";
7    set_exception_handler('exception_handler_2');
8}
9
10function exception_handler_2($ex) {
11    echo "Handler 2\n";
12}
13
14set_exception_handler('exception_handler_1');
15
16register_shutdown_function(function () {
17    echo set_exception_handler(null), "\n";
18    restore_exception_handler();
19});
20
21throw new Exception();
22?>
23--EXPECT--
24Handler 1
25exception_handler_2
26