3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Role implements \Serializable { protected $id = 0; protected $b = null; public function __construct($id) { $this->id = $id; } public function serialize() { return serialize([$this->id, $this->b]); } public function unserialize($serialized) { list($this->id, $this->b) = unserialize($serialized); } } class AbstractToken implements \Serializable { public $role1; public $role2; public function __construct($role) { $this->role1 = $role; $this->role2 = $role; } public function serialize() { return serialize([$this->role1, $this->role2]); } public function unserialize($serialized) { list($this->role1, $this->role2) = unserialize($serialized); } } class Token extends AbstractToken { public $id; public function __construct($id, $role) { $this->id = $id; parent::__construct($role); } public function serialize() { return serialize([$this->id, parent::serialize()]); } public function unserialize($serialized) { list($this->id, $parentStr) = unserialize($serialized); parent::unserialize($parentStr); } } $token = new Token(1, new Role(1)); $s = serialize($token); $broken = unserialize($s); var_dump($token->role2); var_dump($broken->role2); exit;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 61) Position 1 = -2
filename:       /in/gMDup
function name:  (null)
number of ops:  30
compiled vars:  !0 = $token, !1 = $s, !2 = $broken
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                                'role'
   23     1        DECLARE_CLASS                                                'abstracttoken'
   44     2        DECLARE_CLASS                                                'token', 'abstracttoken'
   64     3        NEW                                                  $3      'Token'
          4        SEND_VAL_EX                                                  1
          5        NEW                                                  $4      'Role'
          6        SEND_VAL_EX                                                  1
          7        DO_FCALL                                          0          
          8        SEND_VAR_NO_REF_EX                                           $4
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !0, $3
   65    11        INIT_FCALL                                                   'serialize'
         12        SEND_VAR                                                     !0
         13        DO_ICALL                                             $8      
         14        ASSIGN                                                       !1, $8
   66    15        INIT_FCALL                                                   'unserialize'
         16        SEND_VAR                                                     !1
         17        DO_ICALL                                             $10     
         18        ASSIGN                                                       !2, $10
   67    19        INIT_FCALL                                                   'var_dump'
         20        FETCH_OBJ_R                                          ~12     !0, 'role2'
         21        SEND_VAL                                                     ~12
         22        DO_ICALL                                                     
   68    23        INIT_FCALL                                                   'var_dump'
         24        FETCH_OBJ_R                                          ~14     !2, 'role2'
         25        SEND_VAL                                                     ~14
         26        DO_ICALL                                                     
   69    27      > INIT_FCALL                                                   'exit'
         28*       DO_ICALL                                                     
         29*     > RETURN                                                       1

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

End of function __construct

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gMDup
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'id'
          2        INIT_ARRAY                                           ~1      ~0
          3        FETCH_OBJ_R                                          ~2      'b'
          4        ADD_ARRAY_ELEMENT                                    ~1      ~2
          5        SEND_VAL                                                     ~1
          6        DO_ICALL                                             $3      
          7      > RETURN                                                       $3
   15     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/gMDup
function name:  unserialize
number of ops:  12
compiled vars:  !0 = $serialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   19     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        FETCH_LIST_R                                         $4      $1, 1
          8        ASSIGN_OBJ                                                   'b'
          9        OP_DATA                                                      $4
         10        FREE                                                         $1
   20    11      > RETURN                                                       null

End of function unserialize

End of class Role.

Class AbstractToken:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gMDup
function name:  __construct
number of ops:  6
compiled vars:  !0 = $role
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   RECV                                                 !0      
   30     1        ASSIGN_OBJ                                                   'role1'
          2        OP_DATA                                                      !0
   31     3        ASSIGN_OBJ                                                   'role2'
          4        OP_DATA                                                      !0
   32     5      > RETURN                                                       null

End of function __construct

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gMDup
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'role1'
          2        INIT_ARRAY                                           ~1      ~0
          3        FETCH_OBJ_R                                          ~2      'role2'
          4        ADD_ARRAY_ELEMENT                                    ~1      ~2
          5        SEND_VAL                                                     ~1
          6        DO_ICALL                                             $3      
          7      > RETURN                                                       $3
   36     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/gMDup
function name:  unserialize
number of ops:  12
compiled vars:  !0 = $serialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   38     0  E >   RECV                                                 !0      
   40     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        FETCH_LIST_R                                         $2      $1, 0
          5        ASSIGN_OBJ                                                   'role1'
          6        OP_DATA                                                      $2
          7        FETCH_LIST_R                                         $4      $1, 1
          8        ASSIGN_OBJ                                                   'role2'
          9        OP_DATA                                                      $4
         10        FREE                                                         $1
   41    11      > RETURN                                                       null

End of function unserialize

End of class AbstractToken.

Class Token:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gMDup
function name:  __construct
number of ops:  8
compiled vars:  !0 = $id, !1 = $role
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   47     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   49     2        ASSIGN_OBJ                                                   'id'
          3        OP_DATA                                                      !0
   50     4        INIT_STATIC_METHOD_CALL                                      
          5        SEND_VAR_EX                                                  !1
          6        DO_FCALL                                          0          
   51     7      > RETURN                                                       null

End of function __construct

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gMDup
function name:  serialize
number of ops:  10
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   54     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'id'
          2        INIT_ARRAY                                           ~1      ~0
          3        INIT_STATIC_METHOD_CALL                                      'serialize'
          4        DO_FCALL                                          0  $2      
          5        ADD_ARRAY_ELEMENT                                    ~1      $2
          6        SEND_VAL                                                     ~1
          7        DO_ICALL                                             $3      
          8      > RETURN                                                       $3
   55     9*     > 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/gMDup
function name:  unserialize
number of ops:  14
compiled vars:  !0 = $serialized, !1 = $parentStr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   57     0  E >   RECV                                                 !0      
   59     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $2      
          4        FETCH_LIST_R                                         $3      $2, 0
          5        ASSIGN_OBJ                                                   'id'
          6        OP_DATA                                                      $3
          7        FETCH_LIST_R                                         $5      $2, 1
          8        ASSIGN                                                       !1, $5
          9        FREE                                                         $2
   60    10        INIT_STATIC_METHOD_CALL                                      'unserialize'
         11        SEND_VAR_EX                                                  !1
         12        DO_FCALL                                          0          
   61    13      > RETURN                                                       null

End of function unserialize

End of class Token.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.16 ms | 3422 KiB | 18 Q