3v4l.org

run code in 300+ PHP versions simultaneously
<?php function error_handler($errno, $errstr, $errfile, $errline) { throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); } set_error_handler('error_handler'); try { echo 5 / 0; } catch(ErrorException $error) { echo new ErrorExceptionHTMLDecorator($error); } /* WARNING Message: Division by zero Code: 2 Line: 71 File: C:\webroot\www\error.php */ class ErrorExceptionHTMLDecorator { protected $error; protected static $levels = array( E_ERROR => 'ERROR', E_WARNING => 'WARNING', E_PARSE => 'PARSING ERROR', E_NOTICE => 'NOTICE', E_CORE_ERROR => 'CORE ERROR', E_CORE_WARNING => 'CORE WARNING', E_COMPILE_ERROR => 'COMPILE ERROR', E_COMPILE_WARNING => 'COMPILE WARNING', E_USER_ERROR => 'USER ERROR', E_USER_WARNING => 'USER WARNING', E_USER_NOTICE => 'USER NOTICE', E_STRICT => 'STRICT NOTICE', E_RECOVERABLE_ERROR => 'RECOVERABLE ERROR' ); public function __construct(ErrorException $error) { $this->error = $error; } public function render() { $level = isset(self::$levels[$this->error->getSeverity()]) ? self::$levels[$this->error->getSeverity()] : 'Unknown Error'; return sprintf( ' <h4>%s</h4> <strong>Message:</strong> %s<br /> <strong>Code:</strong> %d<br /> <strong>Line:</strong> %s <strong>File:</strong> %s ', $level, $this->error->getMessage(), $this->error->getCode(), $this->error->getLine(), $this->error->getFile() ); } public function __toString() { return strip_tags($this->render()); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 6
Branch analysis from position: 6
2 jumps found. (Code = 107) Position 1 = 7, Position 2 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XVrsb
function name:  (null)
number of ops:  13
compiled vars:  !0 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'error_handler'
          2        DO_ICALL                                                 
   14     3        DIV                                              ~2      5, 0
          4        ECHO                                                     ~2
          5      > JMP                                                      ->11
   16     6  E > > CATCH                                       last         'ErrorException'
   18     7    >   NEW                                              $3      'ErrorExceptionHTMLDecorator'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10        ECHO                                                     $3
   30    11    >   DECLARE_CLASS                                            'errorexceptionhtmldecorator'
   80    12      > RETURN                                                   1

Function error_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/XVrsb
function name:  error_handler
number of ops:  13
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    5     4        NEW                                              $4      'ErrorException'
          5        SEND_VAR_EX                                              !1
          6        SEND_VAR_EX                                              !0
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !2
          9        SEND_VAR_EX                                              !3
         10        DO_FCALL                                      0          
         11      > THROW                                         0          $4
    6    12*     > RETURN                                                   null

End of function error_handler

Class ErrorExceptionHTMLDecorator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XVrsb
function name:  __construct
number of ops:  4
compiled vars:  !0 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
   51     1        ASSIGN_OBJ                                               'error'
          2        OP_DATA                                                  !0
   52     3      > RETURN                                                   null

End of function __construct

Function render:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XVrsb
function name:  render
number of ops:  37
compiled vars:  !0 = $level
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   FETCH_OBJ_R                                      ~2      'error'
          1        INIT_METHOD_CALL                                         ~2, 'getSeverity'
          2        DO_FCALL                                      0  $3      
          3        FETCH_STATIC_PROP_IS                             ~1      'levels'
          4        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, $3
          5      > JMPZ                                                     ~4, ->13
   57     6    >   FETCH_OBJ_R                                      ~6      'error'
          7        INIT_METHOD_CALL                                         ~6, 'getSeverity'
          8        DO_FCALL                                      0  $7      
          9        FETCH_STATIC_PROP_R          unknown             ~5      'levels'
         10        FETCH_DIM_R                                      ~8      ~5, $7
         11        QM_ASSIGN                                        ~9      ~8
         12      > JMP                                                      ->14
   58    13    >   QM_ASSIGN                                        ~9      'Unknown+Error'
   56    14    >   ASSIGN                                                   !0, ~9
   60    15        INIT_FCALL                                               'sprintf'
   61    16        SEND_VAL                                                 '%0A++++++++++++%3Ch4%3E%25s%3C%2Fh4%3E%0A++++++++++++%3Cstrong%3EMessage%3A%3C%2Fstrong%3E+%25s%3Cbr+%2F%3E%0A++++++++++++%3Cstrong%3ECode%3A%3C%2Fstrong%3E+%25d%3Cbr+%2F%3E%0A++++++++++++%3Cstrong%3ELine%3A%3C%2Fstrong%3E+%25s%0A++++++++++++%3Cstrong%3EFile%3A%3C%2Fstrong%3E+%25s%0A++++++++++++'
   68    17        SEND_VAR                                                 !0
   69    18        FETCH_OBJ_R                                      ~11     'error'
         19        INIT_METHOD_CALL                                         ~11, 'getMessage'
         20        DO_FCALL                                      0  $12     
         21        SEND_VAR                                                 $12
   70    22        FETCH_OBJ_R                                      ~13     'error'
         23        INIT_METHOD_CALL                                         ~13, 'getCode'
         24        DO_FCALL                                      0  $14     
         25        SEND_VAR                                                 $14
   71    26        FETCH_OBJ_R                                      ~15     'error'
         27        INIT_METHOD_CALL                                         ~15, 'getLine'
         28        DO_FCALL                                      0  $16     
         29        SEND_VAR                                                 $16
   72    30        FETCH_OBJ_R                                      ~17     'error'
         31        INIT_METHOD_CALL                                         ~17, 'getFile'
         32        DO_FCALL                                      0  $18     
         33        SEND_VAR                                                 $18
         34        DO_ICALL                                         $19     
         35      > RETURN                                                   $19
   74    36*     > RETURN                                                   null

End of function render

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XVrsb
function name:  __toString
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   78     0  E >   INIT_FCALL                                               'strip_tags'
          1        INIT_METHOD_CALL                                         'render'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                         $1      
          5        VERIFY_RETURN_TYPE                                       $1
          6      > RETURN                                                   $1
   79     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function __tostring

End of class ErrorExceptionHTMLDecorator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.38 ms | 1404 KiB | 19 Q