3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Permission implements \Serializable { protected $id = 3; public function serialize() { return serialize(array($this->id)); } public function unserialize($serialized) { list($this->id) = unserialize($serialized); } } class UserPermission implements \Serializable { public $permission; public $webshop; public function serialize() { return serialize(array($this->webshop, $this->permission)); } public function unserialize($serialized) { list($this->webshop, $this->permission) = unserialize($serialized); } } class Webshop implements \Serializable { protected $id = 13; public function serialize() { return serialize(array($this->id)); } public function unserialize($serialized) { list($this->id) = unserialize($serialized); } } class AbstractToken implements \Serializable { public $roles; public function serialize() { return serialize(array($this->roles)); } public function unserialize($serialized) { list($this->roles) = unserialize($serialized); } } class UsernamePasswordToken extends AbstractToken { private $credentials = null; private $providerKey = null; public function serialize() { return serialize(array($this->credentials, $this->providerKey, parent::serialize())); } public function unserialize($str) { list($this->credentials, $this->providerKey, $parentStr) = unserialize($str); parent::unserialize($parentStr); } } $token = new UsernamePasswordToken(); $webshop = new Webshop; $permission = new Permission; $roles = array(); for ($i = 0; $i < 2; $i++) { $roles[$i] = new UserPermission(); $roles[$i]->webshop = $webshop; $roles[$i]->permission = $permission; } $token->roles = $roles; var_dump(unserialize(serialize($token)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 17
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 17
Branch analysis from position: 30
Branch analysis from position: 17
filename:       /in/QFDDc
function name:  (null)
number of ops:  42
compiled vars:  !0 = $token, !1 = $webshop, !2 = $permission, !3 = $roles, !4 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                                'permission'
   15     1        DECLARE_CLASS                                                'userpermission'
   29     2        DECLARE_CLASS                                                'webshop'
   42     3        DECLARE_CLASS                                                'abstracttoken'
   55     4        DECLARE_CLASS                                                'usernamepasswordtoken', 'abstracttoken'
   71     5        NEW                                                  $5      'UsernamePasswordToken'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !0, $5
   72     8        NEW                                                  $8      'Webshop'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !1, $8
   73    11        NEW                                                  $11     'Permission'
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !2, $11
   74    14        ASSIGN                                                       !3, <array>
   75    15        ASSIGN                                                       !4, 0
         16      > JMP                                                          ->28
   76    17    >   NEW                                                  $17     'UserPermission'
         18        DO_FCALL                                          0          
         19        ASSIGN_DIM                                                   !3, !4
         20        OP_DATA                                                      $17
   77    21        FETCH_DIM_W                                          $19     !3, !4
         22        ASSIGN_OBJ                                                   $19, 'webshop'
         23        OP_DATA                                                      !1
   78    24        FETCH_DIM_W                                          $21     !3, !4
         25        ASSIGN_OBJ                                                   $21, 'permission'
         26        OP_DATA                                                      !2
   75    27        PRE_INC                                                      !4
         28    >   IS_SMALLER                                                   !4, 2
         29      > JMPNZ                                                        ~24, ->17
   80    30    >   ASSIGN_OBJ                                                   !0, 'roles'
         31        OP_DATA                                                      !3
   81    32        INIT_FCALL                                                   'var_dump'
         33        INIT_FCALL                                                   'unserialize'
         34        INIT_FCALL                                                   'serialize'
         35        SEND_VAR                                                     !0
         36        DO_ICALL                                             $26     
         37        SEND_VAR                                                     $26
         38        DO_ICALL                                             $27     
         39        SEND_VAR                                                     $27
         40        DO_ICALL                                                     
         41      > RETURN                                                       1

Class Permission:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  serialize
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'id'
          2        INIT_ARRAY                                           ~1      ~0
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                             $2      
          5      > RETURN                                                       $2
    7     6*     > RETURN                                                       null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  unserialize
number of ops:  9
compiled vars:  !0 = $serialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
   10     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        FETCH_LIST_R                                         $2      $1, 0
          5        ASSIGN_OBJ                                                   'id'
          6        OP_DATA                                                      $2
          7        FREE                                                         $1
   11     8      > RETURN                                                       null

End of function unserialize

End of class Permission.

Class UserPermission:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'webshop'
          2        INIT_ARRAY                                           ~1      ~0
          3        FETCH_OBJ_R                                          ~2      'permission'
          4        ADD_ARRAY_ELEMENT                                    ~1      ~2
          5        SEND_VAL                                                     ~1
          6        DO_ICALL                                             $3      
          7      > RETURN                                                       $3
   22     8*     > RETURN                                                       null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  unserialize
number of ops:  12
compiled vars:  !0 = $serialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   RECV                                                 !0      
   25     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        FETCH_LIST_R                                         $2      $1, 0
          5        ASSIGN_OBJ                                                   'webshop'
          6        OP_DATA                                                      $2
          7        FETCH_LIST_R                                         $4      $1, 1
          8        ASSIGN_OBJ                                                   'permission'
          9        OP_DATA                                                      $4
         10        FREE                                                         $1
   26    11      > RETURN                                                       null

End of function unserialize

End of class UserPermission.

Class Webshop:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  serialize
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   33     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'id'
          2        INIT_ARRAY                                           ~1      ~0
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                             $2      
          5      > RETURN                                                       $2
   34     6*     > RETURN                                                       null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  unserialize
number of ops:  9
compiled vars:  !0 = $serialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   RECV                                                 !0      
   37     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        FETCH_LIST_R                                         $2      $1, 0
          5        ASSIGN_OBJ                                                   'id'
          6        OP_DATA                                                      $2
          7        FREE                                                         $1
   38     8      > RETURN                                                       null

End of function unserialize

End of class Webshop.

Class AbstractToken:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  serialize
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   47     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'roles'
          2        INIT_ARRAY                                           ~1      ~0
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                             $2      
          5      > RETURN                                                       $2
   48     6*     > RETURN                                                       null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  unserialize
number of ops:  9
compiled vars:  !0 = $serialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   49     0  E >   RECV                                                 !0      
   51     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        FETCH_LIST_R                                         $2      $1, 0
          5        ASSIGN_OBJ                                                   'roles'
          6        OP_DATA                                                      $2
          7        FREE                                                         $1
   52     8      > RETURN                                                       null

End of function unserialize

End of class AbstractToken.

Class UsernamePasswordToken:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  serialize
number of ops:  12
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   61     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'credentials'
          2        INIT_ARRAY                                           ~1      ~0
          3        FETCH_OBJ_R                                          ~2      'providerKey'
          4        ADD_ARRAY_ELEMENT                                    ~1      ~2
          5        INIT_STATIC_METHOD_CALL                                      'serialize'
          6        DO_FCALL                                          0  $3      
          7        ADD_ARRAY_ELEMENT                                    ~1      $3
          8        SEND_VAL                                                     ~1
          9        DO_ICALL                                             $4      
         10      > RETURN                                                       $4
   62    11*     > RETURN                                                       null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFDDc
function name:  unserialize
number of ops:  17
compiled vars:  !0 = $str, !1 = $parentStr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   64     0  E >   RECV                                                 !0      
   66     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $2      
          4        FETCH_LIST_R                                         $3      $2, 0
          5        ASSIGN_OBJ                                                   'credentials'
          6        OP_DATA                                                      $3
          7        FETCH_LIST_R                                         $5      $2, 1
          8        ASSIGN_OBJ                                                   'providerKey'
          9        OP_DATA                                                      $5
         10        FETCH_LIST_R                                         $7      $2, 2
         11        ASSIGN                                                       !1, $7
         12        FREE                                                         $2
   67    13        INIT_STATIC_METHOD_CALL                                      'unserialize'
         14        SEND_VAR_EX                                                  !1
         15        DO_FCALL                                          0          
   68    16      > RETURN                                                       null

End of function unserialize

End of class UsernamePasswordToken.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.35 ms | 3463 KiB | 16 Q