3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SEGV { private $obj; public function __construct() { } // there should be construct to get SEGV public function segv() { $this->obj->attribute = "TEST"; } public function getObj() { return $this->obj; } } $s = new SEGV; //$s->segv(); // if value of obj is set from the inside of class, it will not get SEGV. $s->getObj()->attribute["TEST"] = "TEST"; // member value is set from the outside of class $s->segv(); // this set function will get SEGV $s->segv(); echo "SUCCESS\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5UBQi
function name:  (null)
number of ops:  15
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'SEGV'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   18     3        INIT_METHOD_CALL                                         !0, 'getObj'
          4        DO_FCALL                                      0  $4      
          5        SEPARATE                                         $4      $4
          6        FETCH_OBJ_W                                      $5      $4, 'attribute'
          7        ASSIGN_DIM                                               $5, 'TEST'
          8        OP_DATA                                                  'TEST'
   19     9        INIT_METHOD_CALL                                         !0, 'segv'
         10        DO_FCALL                                      0          
   20    11        INIT_METHOD_CALL                                         !0, 'segv'
         12        DO_FCALL                                      0          
   21    13        ECHO                                                     'SUCCESS%0A'
         14      > RETURN                                                   1

Class SEGV:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5UBQi
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   null

End of function __construct

Function segv:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5UBQi
function name:  segv
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_W                                      $0      'obj'
          1        ASSIGN_OBJ                                               $0, 'attribute'
          2        OP_DATA                                                  'TEST'
    9     3      > RETURN                                                   null

End of function segv

Function getobj:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5UBQi
function name:  getObj
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                      ~0      'obj'
          1      > RETURN                                                   ~0
   13     2*     > RETURN                                                   null

End of function getobj

End of class SEGV.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.09 ms | 1395 KiB | 13 Q