"Fossies" - the Fresh Open Source Software Archive

Member "Symfony/vendor/symfony/symfony/src/Symfony/Component/Debug/Resources/ext/tests/003.phpt" (30 Mar 2020, 2090 Bytes) of package /linux/www/Symfony_Standard_Vendors_3.4.39.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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