3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Acl implements \Serializable { private $id; private $objectIdentity; public function __construct($id, $objectIdentity) { $this->id = $id; $this->objectIdentity = $objectIdentity; } public function serialize() { return serialize([$this->id, $this->objectIdentity]); } public function unserialize($string) { list ($this->id, $this->objectIdentity) = unserialize($string); } } class Entry implements \Serializable { private $id; private $acl; private $sid; public function __construct($id, $acl, $sid) { $this->id = $id; $this->acl = $acl; $this->sid = $sid; } public function getSid() { return $this->sid; } public function serialize() { return serialize([$this->id, $this->sid]); } public function unserialize($string) { list ($this->id, $this->sid) = unserialize($string); } } class FieldEntry extends Entry implements \Serializable { private $field; public function __construct($id, $acl, $field, $sid) { parent::__construct($id, $acl, $sid); $this->field = $field; } public function serialize() { return serialize([$this->field, parent::serialize()]); } public function unserialize($string) { list($this->field, $parentStr) = unserialize($string); parent::unserialize($parentStr); } } final class Role { private $role; public function __construct($name) { $this->role = $name; } public function getRole() { return $this->role; } public function __toString() { return sprintf('RoleSecurityIdentity(%s)', $this->role); } } $acl = new Acl(1, null); $acl = new Acl(2, null); $sid = new Role('test'); $a = new FieldEntry(1, $acl, 'name', $sid, 'blabla'); $a1 = new FieldEntry(2, $acl, 'age', $sid, 'blabla'); $s = serialize( array( // Acl:serialize (line 260) [ // classFieldAces 'fieldOne' => [$a], 'fieldTwo' => [$a1], ] ) ); var_dump($s); $uns = unserialize($s); var_dump($uns[0]['fieldOne'][0]->getSid(), $uns[0]['fieldTwo'][0]->getSid());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sSL6F
function name:  (null)
number of ops:  65
compiled vars:  !0 = $acl, !1 = $sid, !2 = $a, !3 = $a1, !4 = $s, !5 = $uns
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'acl'
   25     1        DECLARE_CLASS                                            'entry'
   54     2        DECLARE_CLASS                                            'fieldentry', 'entry'
   75     3        DECLARE_CLASS                                            'role'
   93     4        NEW                                              $6      'Acl'
          5        SEND_VAL_EX                                              1
          6        SEND_VAL_EX                                              null
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !0, $6
   94     9        NEW                                              $9      'Acl'
         10        SEND_VAL_EX                                              2
         11        SEND_VAL_EX                                              null
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !0, $9
   96    14        NEW                                              $12     'Role'
         15        SEND_VAL_EX                                              'test'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !1, $12
   98    18        NEW                                              $15     'FieldEntry'
         19        SEND_VAL_EX                                              1
         20        SEND_VAR_EX                                              !0
         21        SEND_VAL_EX                                              'name'
         22        SEND_VAR_EX                                              !1
         23        SEND_VAL_EX                                              'blabla'
         24        DO_FCALL                                      0          
         25        ASSIGN                                                   !2, $15
   99    26        NEW                                              $18     'FieldEntry'
         27        SEND_VAL_EX                                              2
         28        SEND_VAR_EX                                              !0
         29        SEND_VAL_EX                                              'age'
         30        SEND_VAR_EX                                              !1
         31        SEND_VAL_EX                                              'blabla'
         32        DO_FCALL                                      0          
         33        ASSIGN                                                   !3, $18
  101    34        INIT_FCALL                                               'serialize'
  104    35        INIT_ARRAY                                       ~21     !2
         36        INIT_ARRAY                                       ~22     ~21, 'fieldOne'
  105    37        INIT_ARRAY                                       ~23     !3
         38        ADD_ARRAY_ELEMENT                                ~22     ~23, 'fieldTwo'
         39        INIT_ARRAY                                       ~24     ~22
         40        SEND_VAL                                                 ~24
         41        DO_ICALL                                         $25     
  101    42        ASSIGN                                                   !4, $25
  111    43        INIT_FCALL                                               'var_dump'
         44        SEND_VAR                                                 !4
         45        DO_ICALL                                                 
  112    46        INIT_FCALL                                               'unserialize'
         47        SEND_VAR                                                 !4
         48        DO_ICALL                                         $28     
         49        ASSIGN                                                   !5, $28
  114    50        INIT_FCALL                                               'var_dump'
         51        FETCH_DIM_R                                      ~30     !5, 0
         52        FETCH_DIM_R                                      ~31     ~30, 'fieldOne'
         53        FETCH_DIM_R                                      ~32     ~31, 0
         54        INIT_METHOD_CALL                                         ~32, 'getSid'
         55        DO_FCALL                                      0  $33     
         56        SEND_VAR                                                 $33
         57        FETCH_DIM_R                                      ~34     !5, 0
         58        FETCH_DIM_R                                      ~35     ~34, 'fieldTwo'
         59        FETCH_DIM_R                                      ~36     ~35, 0
         60        INIT_METHOD_CALL                                         ~36, 'getSid'
         61        DO_FCALL                                      0  $37     
         62        SEND_VAR                                                 $37
         63        DO_ICALL                                                 
         64      > RETURN                                                   1

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

End of function unserialize

End of class Acl.

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

End of function __construct

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

End of function getsid

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sSL6F
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'id'
          2        INIT_ARRAY                                       ~1      ~0
          3        FETCH_OBJ_R                                      ~2      'sid'
          4        ADD_ARRAY_ELEMENT                                ~1      ~2
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   46     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/sSL6F
function name:  unserialize
number of ops:  12
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   RECV                                             !0      
   50     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                                               'sid'
          9        OP_DATA                                                  $4
         10        FREE                                                     $1
   51    11      > RETURN                                                   null

End of function unserialize

End of class Entry.

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

End of function unserialize

End of class FieldEntry.

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

End of function __construct

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

End of function getrole

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sSL6F
function name:  __toString
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   89     0  E >   INIT_FCALL                                               'sprintf'
          1        SEND_VAL                                                 'RoleSecurityIdentity%28%25s%29'
          2        FETCH_OBJ_R                                      ~0      'role'
          3        SEND_VAL                                                 ~0
          4        DO_ICALL                                         $1      
          5        VERIFY_RETURN_TYPE                                       $1
          6      > RETURN                                                   $1
   90     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function __tostring

End of class Role.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.83 ms | 1416 KiB | 21 Q