3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ErrorHandler { /** * Error number constant used when an error is silenced by use of the error * control operator '@'. * * @var int */ const E_SILENCED_ERROR = 0; /** * Chain before * @var string */ const CHAIN_BEFORE = 'before'; /** * Chain after * @var string */ const CHAIN_AFTER = 'after'; /** * Don't chain * @var bool */ const CHAIN_NONE = false; /** * @var string|bool */ private $_chainPreviousHandler = self::CHAIN_AFTER; /** * Gets if the previous handler will be called. Values are: before, after, false * @return string|bool */ public function getChainPreviousHandler() { return $this->_chainPreviousHandler; } /** * Sets if the previous handler will be called. Values are: before, after, false * @param string|bool $chainPreviousHandler */ public function setChainPreviousHandler($chainPreviousHandler) { $this->_chainPreviousHandler = $chainPreviousHandler; } /** * @var bool */ private $_usePhpDefaultBehaviour = true; /** * Gets if the default PHP behaviour for errors will be allowed at the end * of the error handling. * @return bool */ public function isUsePhpDefaultBehaviour() { return $this->_usePhpDefaultBehaviour; } /** * Sets if the default PHP behaviour for errors will be allowed at the end * of the error handling. * @param bool $usePhpDefaultBehaviour */ public function setUsePhpDefaultBehaviour($usePhpDefaultBehaviour) { $this->_usePhpDefaultBehaviour = $usePhpDefaultBehaviour; } /** * @var bool */ private $_convertErrorsToExceptions = true; /** * Gets if this handler will convert recoverable errors to exceptions * @return bool */ public function isConvertErrorsToExceptions() { return $this->_convertErrorsToExceptions; } /** * Sets if this handler will convert recoverable errors to exceptions * @param bool $convertErrorsToExceptions */ protected function setConvertErrorsToExceptions($convertErrorsToExceptions) { $this->_convertErrorsToExceptions = $convertErrorsToExceptions; } /** * Array of default errors converted to exceptions. * @var array */ private $_errorsToExceptions = array( self::E_SILENCED_ERROR, // Silenced errors E_USER_ERROR, E_RECOVERABLE_ERROR); /** * Gets an array with all the error numbers to be converted to exceptions * @return array */ public function getErrorsToExceptions() { return $this->_errorsToExceptions; } /** * Sets an array with all the error numbers to be converted to exceptions * @param array $errorsToExceptions */ public function setErrorsToExceptions(array $errorsToExceptions) { $this->_errorsToExceptions = $errorsToExceptions; } /** * Adds errors to the array of errors that will throw an exception * @param array $errorsToExceptions */ public function addErrorsToExceptions(array $errorsToExceptions) { foreach($errorsToExceptions as $pos => $errorNumber) { if (!in_array($errorNumber, $this->_errorsToExceptions)) { $this->_errorsToExceptions[] = $errorNumber; } } } /** * @var bool */ private $_registered = false; /** * Gets if this class was registered to be the default error handler for * php errors. * @return bool */ public function isRegistered() { return $this->_registered; } /** * Sets if this class was registered to be the default error handler for * php errors. * @param bool $registered */ protected function setRegistered($registered) { $this->_registered = $registered; } /** * @var mixed */ private $_previousHandler = null; /** * Gets the previously set global error handler * @return mixed */ public function getPreviousErrorHandler() { return $this->_previousHandler; } /** * Sets the previously set global error handler * @param mixed $previousHandler */ protected function setPreviousErrorHandler($previousHandler) { $this->_previousHandler = $previousHandler; } /** * @var array */ private $_errorHandlers = array(); /** * Gets stack of error handlers * @return array */ public function getErrorHandlers() { return $this->_errorHandlers; } /** * Adds a handler to the stack of error handlers * @param callable $errorHandler */ public function addErrorHandler(callable $errorHandler) { // Avoid duplicated error handlers $this->removeErrorHandler($errorHandler); $this->_errorHandlers[]= $errorHandler; } /** * Remove the error handler comparing the one provided with the ones stored. * It does not affect the previous error handler. * @param callable $errorHandler * @return boolean True if an error handler was found and removed or false * if not. */ public function removeErrorHandler($errorHandler) { $type = gettype($errorHandler); $found = false; foreach($this->_errorHandlers as $pos => $existingErrorHandler) { if ($type != gettype($existingErrorHandler)) { continue; } $remove = false; if ($type == 'string' && $errorHandler == $existingErrorHandler) { $found = true; } else if ($type == 'array' && $errorHandler[0] == $existingErrorHandler[0] && $errorHandler[1] == $existingErrorHandler[1]) { $found = true; } else if (is_object($errorHandler) && $errorHandler == $existingErrorHandler) { $found = true; } if ($remove) { unset($this->_errorHandlers[$pos]); $found = true; break; } } return $found; } /** * Finds the name of an error constant. * * @param int $error * @return string | false */ public function getErrorName($error) { $constants = get_defined_constants(); $name = array_search($error, $constants, true); return $name; } /** * Calls every error handler passing in the arguments. * * If an error handler throws an exception the rest of error handlers will * not be called. * * If this class is set as the default error handler the previous handler * will be called after all handlers have been called. * * Error handlers must conform to standard error handler signature for * set_error_handler function but with an additional optional parameter * whose value will be this same instance. * * This method follows the following order: * 1- Execute previous error handler (only uf previous error handler is * chained before) * 2- Execute error handlers * 3- Execute previous error handler (only uf previous error handler is * chained after) * 4- Throw exceptions for errors (optional) * 5- Call PHP's default error handler if configured to do so. * * Error handlers should not raise more errors but they can throw exceptions * as they will not be handled in this method so they can be handled * upstream. * * @param int $errorNumber * @param string $errorMessage * @param string $file * @param int $line * @param array $context * @throws \ErrorException When error to exception conversion is enabled * @throws \Exception When any error handler throws it * @return bool */ public function handleError($errorNumber, $errorMessage, $file, $line, $context) { $errorParams = array( $errorNumber, $errorMessage, $file, $line, $context, $this ); if ($this->_previousHandler && $this->_chainPreviousHandler == self::CHAIN_BEFORE) { call_user_func_array($this->_previousHandler, $errorParams); } foreach($this->_errorHandlers as $errorHandler) { call_user_func_array($errorHandler, $errorParams); } if ($this->_previousHandler && $this->_chainPreviousHandler == self::CHAIN_AFTER) { call_user_func_array($this->_previousHandler, $errorParams); } // The last thing we do is throwing ourselves an exception in the // error handler as this will halt execution and we need to call // all error handlers first. if ($this->_convertErrorsToExceptions) { $this->throwErrorException($errorNumber, $errorMessage, $file, $line, $context); } if ($this->_usePhpDefaultBehaviour) { return false; } else { return true; } } /** * Throws an ErrorException with the given information. * * This method does not honors error_reporting setting and will throw an * exception for every configured error number as it makes no sense to * convert a certain error to an exception and then allow it to be * "silenced". * * @param int $errorNumber * @param string $errorMessage * @param string $file * @param int $line * @param array $context * @throws \ErrorException Always */ protected function throwErrorException($errorNumber, $errorMessage, $file, $line, array $context) { if (in_array($errorNumber, $this->_errorsToExceptions)) { throw new \ErrorException( $errorMessage, $errorNumber, 0, $file, $line); } } /** * Registers this instance to handle PHP's errors (recoverable ones only) * @throws \Exception If the error handler is registered twice for some * reason. * @return boolean True if this handler was not registered, false if it * was. */ public function registerErrorHandler() { if ($this->_registered) { return false; } $previousHandler = set_error_handler(array($this, 'handleError')); if (is_array($previousHandler) && !empty($previousHandler) && $previousHandler[0] === $this) { throw new \Exception("Error handler registered twice!"); } $this->_previousHandler = $previousHandler; $this->_registered = true; return true; } /** * Unregisters this instance if it was set to handle PHP's errors * @return boolean True if this handler was registered, false if it doesn't. */ public function unregisterErrorHandler() { if (!$this->_registered) { return false; } // If one or more error handlers were set after we registered our own // this will pop the last one set and leave our own one in the stack // :( restore_error_handler(); $this->_registered = false; $this->_previousHandler = null; return true; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  399     0  E > > RETURN                                                   1

Class ErrorHandler:
Function getchainprevioushandler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  getChainPreviousHandler
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   FETCH_OBJ_R                                      ~0      '_chainPreviousHandler'
          1      > RETURN                                                   ~0
   42     2*     > RETURN                                                   null

End of function getchainprevioushandler

Function setchainprevioushandler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  setChainPreviousHandler
number of ops:  4
compiled vars:  !0 = $chainPreviousHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   RECV                                             !0      
   49     1        ASSIGN_OBJ                                               '_chainPreviousHandler'
          2        OP_DATA                                                  !0
   50     3      > RETURN                                                   null

End of function setchainprevioushandler

Function isusephpdefaultbehaviour:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  isUsePhpDefaultBehaviour
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   FETCH_OBJ_R                                      ~0      '_usePhpDefaultBehaviour'
          1      > RETURN                                                   ~0
   64     2*     > RETURN                                                   null

End of function isusephpdefaultbehaviour

Function setusephpdefaultbehaviour:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  setUsePhpDefaultBehaviour
number of ops:  4
compiled vars:  !0 = $usePhpDefaultBehaviour
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   71     0  E >   RECV                                             !0      
   72     1        ASSIGN_OBJ                                               '_usePhpDefaultBehaviour'
          2        OP_DATA                                                  !0
   73     3      > RETURN                                                   null

End of function setusephpdefaultbehaviour

Function isconverterrorstoexceptions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  isConvertErrorsToExceptions
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   85     0  E >   FETCH_OBJ_R                                      ~0      '_convertErrorsToExceptions'
          1      > RETURN                                                   ~0
   86     2*     > RETURN                                                   null

End of function isconverterrorstoexceptions

Function setconverterrorstoexceptions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  setConvertErrorsToExceptions
number of ops:  4
compiled vars:  !0 = $convertErrorsToExceptions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   92     0  E >   RECV                                             !0      
   93     1        ASSIGN_OBJ                                               '_convertErrorsToExceptions'
          2        OP_DATA                                                  !0
   94     3      > RETURN                                                   null

End of function setconverterrorstoexceptions

Function geterrorstoexceptions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  getErrorsToExceptions
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   FETCH_OBJ_R                                      ~0      '_errorsToExceptions'
          1      > RETURN                                                   ~0
  111     2*     > RETURN                                                   null

End of function geterrorstoexceptions

Function seterrorstoexceptions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  setErrorsToExceptions
number of ops:  4
compiled vars:  !0 = $errorsToExceptions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  117     0  E >   RECV                                             !0      
  118     1        ASSIGN_OBJ                                               '_errorsToExceptions'
          2        OP_DATA                                                  !0
  119     3      > RETURN                                                   null

End of function seterrorstoexceptions

Function adderrorstoexceptions:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 14
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/r1cJ4
function name:  addErrorsToExceptions
number of ops:  17
compiled vars:  !0 = $errorsToExceptions, !1 = $errorNumber, !2 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  125     0  E >   RECV                                             !0      
  126     1      > FE_RESET_R                                       $3      !0, ->15
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->15
          3    >   ASSIGN                                                   !2, ~4
  127     4        INIT_FCALL                                               'in_array'
          5        SEND_VAR                                                 !1
          6        FETCH_OBJ_R                                      ~6      '_errorsToExceptions'
          7        SEND_VAL                                                 ~6
          8        DO_ICALL                                         $7      
          9        BOOL_NOT                                         ~8      $7
         10      > JMPZ                                                     ~8, ->14
  128    11    >   FETCH_OBJ_W                                      $9      '_errorsToExceptions'
         12        ASSIGN_DIM                                               $9
         13        OP_DATA                                                  !1
  126    14    > > JMP                                                      ->2
         15    >   FE_FREE                                                  $3
  131    16      > RETURN                                                   null

End of function adderrorstoexceptions

Function isregistered:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  isRegistered
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  144     0  E >   FETCH_OBJ_R                                      ~0      '_registered'
          1      > RETURN                                                   ~0
  145     2*     > RETURN                                                   null

End of function isregistered

Function setregistered:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  setRegistered
number of ops:  4
compiled vars:  !0 = $registered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  152     0  E >   RECV                                             !0      
  153     1        ASSIGN_OBJ                                               '_registered'
          2        OP_DATA                                                  !0
  154     3      > RETURN                                                   null

End of function setregistered

Function getpreviouserrorhandler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  getPreviousErrorHandler
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  166     0  E >   FETCH_OBJ_R                                      ~0      '_previousHandler'
          1      > RETURN                                                   ~0
  167     2*     > RETURN                                                   null

End of function getpreviouserrorhandler

Function setpreviouserrorhandler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  setPreviousErrorHandler
number of ops:  4
compiled vars:  !0 = $previousHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  173     0  E >   RECV                                             !0      
  174     1        ASSIGN_OBJ                                               '_previousHandler'
          2        OP_DATA                                                  !0
  175     3      > RETURN                                                   null

End of function setpreviouserrorhandler

Function geterrorhandlers:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  getErrorHandlers
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  187     0  E >   FETCH_OBJ_R                                      ~0      '_errorHandlers'
          1      > RETURN                                                   ~0
  188     2*     > RETURN                                                   null

End of function geterrorhandlers

Function adderrorhandler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  addErrorHandler
number of ops:  8
compiled vars:  !0 = $errorHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  194     0  E >   RECV                                             !0      
  196     1        INIT_METHOD_CALL                                         'removeErrorHandler'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
  198     4        FETCH_OBJ_W                                      $2      '_errorHandlers'
          5        ASSIGN_DIM                                               $2
          6        OP_DATA                                                  !0
  199     7      > RETURN                                                   null

End of function adderrorhandler

Function removeerrorhandler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 46
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 46
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 45
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 34
2 jumps found. (Code = 46) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 40
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 45
Branch analysis from position: 41
Branch analysis from position: 45
Branch analysis from position: 40
Branch analysis from position: 38
Branch analysis from position: 31
Branch analysis from position: 26
Branch analysis from position: 17
Branch analysis from position: 46
Branch analysis from position: 46
filename:       /in/r1cJ4
function name:  removeErrorHandler
number of ops:  49
compiled vars:  !0 = $errorHandler, !1 = $type, !2 = $found, !3 = $existingErrorHandler, !4 = $pos, !5 = $remove
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  208     0  E >   RECV                                             !0      
  209     1        GET_TYPE                                         ~6      !0
          2        ASSIGN                                                   !1, ~6
  210     3        ASSIGN                                                   !2, <false>
  212     4        FETCH_OBJ_R                                      ~9      '_errorHandlers'
          5      > FE_RESET_R                                       $10     ~9, ->46
          6    > > FE_FETCH_R                                       ~11     $10, !3, ->46
          7    >   ASSIGN                                                   !4, ~11
  213     8        GET_TYPE                                         ~13     !3
          9        IS_NOT_EQUAL                                             !1, ~13
         10      > JMPZ                                                     ~14, ->12
  214    11    > > JMP                                                      ->6
  217    12    >   ASSIGN                                                   !5, <false>
  219    13        IS_EQUAL                                         ~16     !1, 'string'
         14      > JMPZ_EX                                          ~16     ~16, ->17
  220    15    >   IS_EQUAL                                         ~17     !0, !3
         16        BOOL                                             ~16     ~17
         17    > > JMPZ                                                     ~16, ->20
  221    18    >   ASSIGN                                                   !2, <true>
         19      > JMP                                                      ->40
  223    20    >   IS_EQUAL                                         ~19     !1, 'array'
         21      > JMPZ_EX                                          ~19     ~19, ->26
  224    22    >   FETCH_DIM_R                                      ~20     !0, 0
         23        FETCH_DIM_R                                      ~21     !3, 0
         24        IS_EQUAL                                         ~22     ~20, ~21
         25        BOOL                                             ~19     ~22
         26    > > JMPZ_EX                                          ~19     ~19, ->31
  225    27    >   FETCH_DIM_R                                      ~23     !0, 1
         28        FETCH_DIM_R                                      ~24     !3, 1
         29        IS_EQUAL                                         ~25     ~23, ~24
         30        BOOL                                             ~19     ~25
         31    > > JMPZ                                                     ~19, ->34
  226    32    >   ASSIGN                                                   !2, <true>
         33      > JMP                                                      ->40
  228    34    >   TYPE_CHECK                                  256  ~27     !0
         35      > JMPZ_EX                                          ~27     ~27, ->38
  229    36    >   IS_EQUAL                                         ~28     !0, !3
         37        BOOL                                             ~27     ~28
         38    > > JMPZ                                                     ~27, ->40
  230    39    >   ASSIGN                                                   !2, <true>
  233    40    > > JMPZ                                                     !5, ->45
  234    41    >   FETCH_OBJ_UNSET                                  $30     '_errorHandlers'
         42        UNSET_DIM                                                $30, !4
  235    43        ASSIGN                                                   !2, <true>
  236    44      > JMP                                                      ->46
  212    45    > > JMP                                                      ->6
         46    >   FE_FREE                                                  $10
  240    47      > RETURN                                                   !2
  241    48*     > RETURN                                                   null

End of function removeerrorhandler

Function geterrorname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  getErrorName
number of ops:  12
compiled vars:  !0 = $error, !1 = $constants, !2 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  249     0  E >   RECV                                             !0      
  250     1        INIT_FCALL                                               'get_defined_constants'
          2        DO_ICALL                                         $3      
          3        ASSIGN                                                   !1, $3
  251     4        INIT_FCALL                                               'array_search'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !2, $5
  252    10      > RETURN                                                   !2
  253    11*     > RETURN                                                   null

End of function geterrorname

Function handleerror:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 32
2 jumps found. (Code = 46) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 44
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 53
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 57
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
Branch analysis from position: 44
Branch analysis from position: 38
Branch analysis from position: 32
Branch analysis from position: 24
Branch analysis from position: 18
filename:       /in/r1cJ4
function name:  handleError
number of ops:  59
compiled vars:  !0 = $errorNumber, !1 = $errorMessage, !2 = $file, !3 = $line, !4 = $context, !5 = $errorParams, !6 = $errorHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  290     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
  293     5        INIT_ARRAY                                       ~7      !0
  294     6        ADD_ARRAY_ELEMENT                                ~7      !1
  295     7        ADD_ARRAY_ELEMENT                                ~7      !2
  296     8        ADD_ARRAY_ELEMENT                                ~7      !3
  297     9        ADD_ARRAY_ELEMENT                                ~7      !4
  298    10        FETCH_THIS                                       ~8      
         11        ADD_ARRAY_ELEMENT                                ~7      ~8
  292    12        ASSIGN                                                   !5, ~7
  301    13        FETCH_OBJ_R                                      ~10     '_previousHandler'
         14      > JMPZ_EX                                          ~10     ~10, ->18
  302    15    >   FETCH_OBJ_R                                      ~11     '_chainPreviousHandler'
         16        IS_EQUAL                                         ~12     ~11, 'before'
         17        BOOL                                             ~10     ~12
         18    > > JMPZ                                                     ~10, ->24
  304    19    >   FETCH_OBJ_R                                      ~13     '_previousHandler'
         20        INIT_USER_CALL                                0          'call_user_func_array', ~13
         21        SEND_ARRAY                                               !5
         22        CHECK_UNDEF_ARGS                                         
         23        DO_FCALL                                      0          
  307    24    >   FETCH_OBJ_R                                      ~15     '_errorHandlers'
         25      > FE_RESET_R                                       $16     ~15, ->32
         26    > > FE_FETCH_R                                               $16, !6, ->32
  308    27    >   INIT_USER_CALL                                0          'call_user_func_array', !6
         28        SEND_ARRAY                                               !5
         29        CHECK_UNDEF_ARGS                                         
         30        DO_FCALL                                      0          
  307    31      > JMP                                                      ->26
         32    >   FE_FREE                                                  $16
  311    33        FETCH_OBJ_R                                      ~18     '_previousHandler'
         34      > JMPZ_EX                                          ~18     ~18, ->38
  312    35    >   FETCH_OBJ_R                                      ~19     '_chainPreviousHandler'
         36        IS_EQUAL                                         ~20     ~19, 'after'
         37        BOOL                                             ~18     ~20
         38    > > JMPZ                                                     ~18, ->44
  314    39    >   FETCH_OBJ_R                                      ~21     '_previousHandler'
         40        INIT_USER_CALL                                0          'call_user_func_array', ~21
         41        SEND_ARRAY                                               !5
         42        CHECK_UNDEF_ARGS                                         
         43        DO_FCALL                                      0          
  320    44    >   FETCH_OBJ_R                                      ~23     '_convertErrorsToExceptions'
         45      > JMPZ                                                     ~23, ->53
  321    46    >   INIT_METHOD_CALL                                         'throwErrorException'
         47        SEND_VAR_EX                                              !0
         48        SEND_VAR_EX                                              !1
         49        SEND_VAR_EX                                              !2
         50        SEND_VAR_EX                                              !3
         51        SEND_VAR_EX                                              !4
         52        DO_FCALL                                      0          
  324    53    >   FETCH_OBJ_R                                      ~25     '_usePhpDefaultBehaviour'
         54      > JMPZ                                                     ~25, ->57
  325    55    > > RETURN                                                   <false>
         56*       JMP                                                      ->58
  328    57    > > RETURN                                                   <true>
  330    58*     > RETURN                                                   null

End of function handleerror

Function throwerrorexception:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cJ4
function name:  throwErrorException
number of ops:  20
compiled vars:  !0 = $errorNumber, !1 = $errorMessage, !2 = $file, !3 = $line, !4 = $context
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  347     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
  348     5        INIT_FCALL                                               'in_array'
          6        SEND_VAR                                                 !0
          7        FETCH_OBJ_R                                      ~5      '_errorsToExceptions'
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                         $6      
         10      > JMPZ                                                     $6, ->19
  350    11    >   NEW                                              $7      'ErrorException'
  351    12        SEND_VAR_EX                                              !1
         13        SEND_VAR_EX                                              !0
         14        SEND_VAL_EX                                              0
         15        SEND_VAR_EX                                              !2
         16        SEND_VAR_EX                                              !3
         17        DO_FCALL                                      0          
         18      > THROW                                         0          $7
  353    19    > > RETURN                                                   null

End of function throwerrorexception

Function registererrorhandler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 3
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 15
filename:       /in/r1cJ4
function name:  registerErrorHandler
number of ops:  31
compiled vars:  !0 = $previousHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  363     0  E >   FETCH_OBJ_R                                      ~1      '_registered'
          1      > JMPZ                                                     ~1, ->3
  364     2    > > RETURN                                                   <false>
  367     3    >   INIT_FCALL                                               'set_error_handler'
          4        FETCH_THIS                                       ~2      
          5        INIT_ARRAY                                       ~3      ~2
          6        ADD_ARRAY_ELEMENT                                ~3      'handleError'
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !0, $4
  369    10        TYPE_CHECK                                  128  ~6      !0
         11      > JMPZ_EX                                          ~6      ~6, ->15
  370    12    >   ISSET_ISEMPTY_CV                                 ~7      !0
         13        BOOL_NOT                                         ~8      ~7
         14        BOOL                                             ~6      ~8
       

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.78 ms | 973 KiB | 22 Q