3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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
Jump found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Jump found. (Code = 44) Position 1 = 40, Position 2 = 26
Branch analysis from position: 40
Jump found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Jump found. (Code = 44) Position 1 = 40, Position 2 = 26
Branch analysis from position: 40
Branch analysis from position: 26
filename:       /in/QFDDc
function name:  (null)
number of ops:  52
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                                    $5      'permission'
         1        ADD_INTERFACE                                            $5, 'Serializable'
         2        VERIFY_ABSTRACT_CLASS                                    $5
  15     3        DECLARE_CLASS                                    $6      'userpermission'
         4        ADD_INTERFACE                                            $6, 'Serializable'
         5        VERIFY_ABSTRACT_CLASS                                    $6
  29     6        DECLARE_CLASS                                    $7      'webshop'
         7        ADD_INTERFACE                                            $7, 'Serializable'
         8        VERIFY_ABSTRACT_CLASS                                    $7
  42     9        DECLARE_CLASS                                    $8      'abstracttoken'
        10        ADD_INTERFACE                                            $8, 'Serializable'
        11        VERIFY_ABSTRACT_CLASS                                    $8
  55    12        FETCH_CLASS                                   0  :9      'AbstractToken'
        13        DECLARE_INHERITED_CLASS                          $10     'usernamepasswordtoken', $9
  71    14        NEW                                              $11     :15
        15        DO_FCALL                                      0          
        16        ASSIGN                                                   !0, $11
  72    17        NEW                                              $14     :17
        18        DO_FCALL                                      0          
        19        ASSIGN                                                   !1, $14
  73    20        NEW                                              $17     :19
        21        DO_FCALL                                      0          
        22        ASSIGN                                                   !2, $17
  74    23        ASSIGN                                                   !3, <array>
  75    24        ASSIGN                                                   !4, 0
        25      > JMP                                                      ->38
  76    26    >   NEW                                              $23     :23
        27        DO_FCALL                                      0          
        28        ASSIGN_DIM                                               !3, !4
        29        OP_DATA                                                  $23
  77    30        FETCH_DIM_W                                      $25     !3, !4
        31        ASSIGN_OBJ                                               $25, 'webshop'
        32        OP_DATA                                                  !1
  78    33        FETCH_DIM_W                                      $27     !3, !4
        34        ASSIGN_OBJ                                               $27, 'permission'
        35        OP_DATA                                                  !2
  75    36        POST_INC                                         ~29     !4
        37        FREE                                                     ~29
        38    >   IS_SMALLER                                       ~30     !4, 2
        39      > JMPNZ                                                    ~30, ->26
  80    40    >   ASSIGN_OBJ                                               !0, 'roles'
        41        OP_DATA                                                  !3
  81    42        INIT_FCALL                                               'var_dump'
        43        INIT_FCALL                                               'unserialize'
        44        INIT_FCALL                                               'serialize'
        45        SEND_VAR                                                 !0
        46        DO_ICALL                                         $32     
        47        SEND_VAR                                                 $32
        48        DO_ICALL                                         $33     
        49        SEND_VAR                                                 $33
        50        DO_ICALL                                                 
        51      > RETURN                                                   1

Class Permission:
Function serialize:
Finding entry points
Branch analysis from position: 0
Jump 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
Jump 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                                       $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
Jump 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
Jump 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                                       $2      $1, 0
         5        ASSIGN_OBJ                                               'webshop'
         6        OP_DATA                                                  $2
         7        FETCH_LIST                                       $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
Jump 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
Jump 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                                       $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
Jump 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
Jump 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                                       $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
Jump 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
Jump 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                                       $3      $2, 0
         5        ASSIGN_OBJ                                               'credentials'
         6        OP_DATA                                                  $3
         7        FETCH_LIST                                       $5      $2, 1
         8        ASSIGN_OBJ                                               'providerKey'
         9        OP_DATA                                                  $5
        10        FETCH_LIST                                       $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 7.1.0