xref: /PHP-7.2/Zend/tests/bug60909_2.phpt (revision 9397f527)
1--TEST--
2Bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function).
3--FILE--
4<?php
5register_shutdown_function(function(){echo("\n\n!!!shutdown!!!\n\n");});
6set_error_handler(function($errno, $errstr, $errfile, $errline){throw new Exception("Foo");});
7
8class Bad {
9    public function __toString() {
10        throw new Exception('Oops, I cannot do this');
11    }
12}
13
14$bad = new Bad();
15echo "$bad";
16--EXPECTF--
17Fatal error: Method Bad::__toString() must not throw an exception, caught Exception: Oops, I cannot do this in %sbug60909_2.php on line %d
18
19
20!!!shutdown!!!
21