2b74e5c6857f38d57884fddd2a1d10346fee542f
[yaffs-website] / vendor / symfony / debug / Tests / phpt / fatal_with_nested_handlers.phpt
1 --TEST--
2 Test catching fatal errors when handlers are nested
3 --FILE--
4 <?php
5
6 namespace Symfony\Component\Debug;
7
8 $vendor = __DIR__;
9 while (!file_exists($vendor.'/vendor')) {
10     $vendor = \dirname($vendor);
11 }
12 require $vendor.'/vendor/autoload.php';
13
14 Debug::enable();
15 ini_set('display_errors', 0);
16
17 $eHandler = set_error_handler('var_dump');
18 $xHandler = set_exception_handler('var_dump');
19
20 var_dump(array(
21     $eHandler[0] === $xHandler[0] ? 'Error and exception handlers do match' : 'Error and exception handlers are different',
22 ));
23
24 $eHandler[0]->setExceptionHandler('print_r');
25
26 if (true) {
27     class Broken implements \Serializable
28     {
29     }
30 }
31
32 ?>
33 --EXPECTF--
34 array(1) {
35   [0]=>
36   string(37) "Error and exception handlers do match"
37 }
38 object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (%d) {
39   ["message":protected]=>
40   string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)"
41 %a
42 }