fatal_with_nested_handlers.phpt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Test catching fatal errors when handlers are nested
  3. --FILE--
  4. <?php
  5. namespace Symfony\Component\Debug;
  6. $vendor = __DIR__;
  7. while (!file_exists($vendor.'/vendor')) {
  8. $vendor = \dirname($vendor);
  9. }
  10. require $vendor.'/vendor/autoload.php';
  11. Debug::enable();
  12. ini_set('display_errors', 0);
  13. $eHandler = set_error_handler('var_dump');
  14. $xHandler = set_exception_handler('var_dump');
  15. var_dump(array(
  16. $eHandler[0] === $xHandler[0] ? 'Error and exception handlers do match' : 'Error and exception handlers are different',
  17. ));
  18. $eHandler[0]->setExceptionHandler('print_r');
  19. if (true) {
  20. class Broken implements \Serializable
  21. {
  22. }
  23. }
  24. ?>
  25. --EXPECTF--
  26. array(1) {
  27. [0]=>
  28. string(37) "Error and exception handlers do match"
  29. }
  30. object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (%d) {
  31. ["message":protected]=>
  32. 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)"
  33. %a
  34. }