Drupal investigation

003.phpt 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. --TEST--
  2. Test ErrorHandler in case of fatal error
  3. --SKIPIF--
  4. <?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
  5. --FILE--
  6. <?php
  7. namespace Psr\Log;
  8. class LogLevel
  9. {
  10. const EMERGENCY = 'emergency';
  11. const ALERT = 'alert';
  12. const CRITICAL = 'critical';
  13. const ERROR = 'error';
  14. const WARNING = 'warning';
  15. const NOTICE = 'notice';
  16. const INFO = 'info';
  17. const DEBUG = 'debug';
  18. }
  19. namespace Symfony\Component\Debug;
  20. $dir = __DIR__.'/../../../';
  21. require $dir.'ErrorHandler.php';
  22. require $dir.'Exception/FatalErrorException.php';
  23. require $dir.'Exception/UndefinedFunctionException.php';
  24. require $dir.'FatalErrorHandler/FatalErrorHandlerInterface.php';
  25. require $dir.'FatalErrorHandler/ClassNotFoundFatalErrorHandler.php';
  26. require $dir.'FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php';
  27. require $dir.'FatalErrorHandler/UndefinedMethodFatalErrorHandler.php';
  28. function bar()
  29. {
  30. foo();
  31. }
  32. function foo()
  33. {
  34. notexist();
  35. }
  36. $handler = ErrorHandler::register();
  37. $handler->setExceptionHandler('print_r');
  38. if (function_exists('xdebug_disable')) {
  39. xdebug_disable();
  40. }
  41. bar();
  42. ?>
  43. --EXPECTF--
  44. Fatal error: Call to undefined function Symfony\Component\Debug\notexist() in %s on line %d
  45. Symfony\Component\Debug\Exception\UndefinedFunctionException Object
  46. (
  47. [message:protected] => Attempted to call function "notexist" from namespace "Symfony\Component\Debug".
  48. [string:Exception:private] =>
  49. [code:protected] => 0
  50. [file:protected] => %s
  51. [line:protected] => %d
  52. [trace:Exception:private] => Array
  53. (
  54. [0] => Array
  55. (
  56. %A [function] => Symfony\Component\Debug\foo
  57. %A [args] => Array
  58. (
  59. )
  60. )
  61. [1] => Array
  62. (
  63. %A [function] => Symfony\Component\Debug\bar
  64. %A [args] => Array
  65. (
  66. )
  67. )
  68. %A
  69. )
  70. [previous:Exception:private] =>
  71. [severity:protected] => 1
  72. )