3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $dummy1; public $dummy2; } class ErrorHandler { private $private = 'THIS IS PRIVATE'."\n"; function __construct() { set_error_handler( function ($errno, $errstr, $errfile, $errline) { $this->handleError($errno, $errstr, $errfile, $errline); } ); } private function handleError($errno, $errstr, $errfile, $errline, $errmodule = null) { echo __METHOD__. " dealing with error $errstr, $errfile:$errline\n"; // This attribute is no longer accessible in this object. Same for other // objects and their private attributes once we reach in this state. echo $this->private; echo "Never executed in PHP7.2; there is a fatal error in the line above\n"; } } function reproduceBug(Foo $f) { unset($f->dummy2); foreach ((new ReflectionObject($f))->getProperties() as $p) echo $p->getName() .' = '. $p->getValue($f) ."\n"; echo "This line is not reached in PHP7.2; but it is reached in PHP 7.0\n"; } $errorHandler = new ErrorHandler(); echo $x; # uncommenting this fixes it reproduceBug(new Foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HWETd
function name:  (null)
number of ops:  10
compiled vars:  !0 = $errorHandler, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   NEW                                              $2      'ErrorHandler'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   46     3        ECHO                                                     !1
   48     4        INIT_FCALL                                               'reproducebug'
          5        NEW                                              $5      'Foo'
          6        DO_FCALL                                      0          
          7        SEND_VAR                                                 $5
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FHWETd%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HWETd
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   17     4        FETCH_THIS                                       $4      
          5        INIT_METHOD_CALL                                         $4, 'handleError'
          6        SEND_VAR_EX                                              !0
          7        SEND_VAR_EX                                              !1
          8        SEND_VAR_EX                                              !2
          9        SEND_VAR_EX                                              !3
         10        DO_FCALL                                      0          
   18    11      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FHWETd%3A16%240

Function reproducebug:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/HWETd
function name:  reproduceBug
number of ops:  22
compiled vars:  !0 = $f, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   36     1        UNSET_OBJ                                                !0, 'dummy2'
   38     2        NEW                                              $2      'ReflectionObject'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $2, 'getProperties'
          6        DO_FCALL                                      0  $4      
          7      > FE_RESET_R                                       $5      $4, ->19
          8    > > FE_FETCH_R                                               $5, !1, ->19
   39     9    >   INIT_METHOD_CALL                                         !1, 'getName'
         10        DO_FCALL                                      0  $6      
         11        CONCAT                                           ~7      $6, '+%3D+'
         12        INIT_METHOD_CALL                                         !1, 'getValue'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0  $8      
         15        CONCAT                                           ~9      ~7, $8
         16        CONCAT                                           ~10     ~9, '%0A'
         17        ECHO                                                     ~10
   38    18      > JMP                                                      ->8
         19    >   FE_FREE                                                  $5
   41    20        ECHO                                                     'This+line+is+not+reached+in+PHP7.2%3B+but+it+is+reached+in+PHP+7.0%0A'
   42    21      > RETURN                                                   null

End of function reproducebug

Class Foo: [no user functions]
Class ErrorHandler:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HWETd
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'set_error_handler'
   16     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FHWETd%3A16%240'
   18     2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   20     4      > RETURN                                                   null

End of function __construct

Function handleerror:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HWETd
function name:  handleError
number of ops:  18
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline, !4 = $errmodule
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV_INIT                                        !4      null
   24     5        ROPE_INIT                                     7  ~6      '+dealing+with+error+'
          6        ROPE_ADD                                      1  ~6      ~6, !1
          7        ROPE_ADD                                      2  ~6      ~6, '%2C+'
          8        ROPE_ADD                                      3  ~6      ~6, !2
          9        ROPE_ADD                                      4  ~6      ~6, '%3A'
         10        ROPE_ADD                                      5  ~6      ~6, !3
         11        ROPE_END                                      6  ~5      ~6, '%0A'
         12        CONCAT                                           ~10     'ErrorHandler%3A%3AhandleError', ~5
         13        ECHO                                                     ~10
   28    14        FETCH_OBJ_R                                      ~11     'private'
         15        ECHO                                                     ~11
   30    16        ECHO                                                     'Never+executed+in+PHP7.2%3B+there+is+a+fatal+error+in+the+line+above%0A'
   31    17      > RETURN                                                   null

End of function handleerror

End of class ErrorHandler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.82 ms | 1407 KiB | 16 Q