3v4l.org

run code in 500+ PHP versions simultaneously
<?php class testClass_forSerialize implements Serializable{ public function serialize() { $ret = new \stdClass(); foreach($this as $k=>$v){ if ($v!==null) { $ret->{$k} = $v; } } $serializedData = serialize($ret); if (unserialize($serializedData)===false) { var_dump($serializedData); throw new \Exception("Serialize failed"); } return $serializedData; } public function unserialize($data) { $dataObj = unserialize($data); foreach($dataObj as $k=>$v) { $this->{$k} = $v; } } } class testClass_forSerialize_02 extends \testClass_forSerialize{ public $list = Array(); public function __construct() { for ($i=0; $i<10; $i++) { $this->list[] = new \testClass_forSerialize(); } } } $obj = new \testClass_forSerialize_02(); $ser = serialize($obj); $obj2 = unserialize($ser);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SggeU
function name:  (null)
number of ops:  14
compiled vars:  !0 = $obj, !1 = $ser, !2 = $obj2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                                'testclass_forserialize'
   33     1        DECLARE_CLASS                                                'testclass_forserialize_02', 'testclass_forserialize'
   45     2        NEW                                                  $3      'testClass_forSerialize_02'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $3
   47     5        INIT_FCALL                                                   'serialize'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $6      
          8        ASSIGN                                                       !1, $6
   48     9        INIT_FCALL                                                   'unserialize'
         10        SEND_VAR                                                     !1
         11        DO_ICALL                                             $8      
         12        ASSIGN                                                       !2, $8
         13      > RETURN                                                       1

Class testClass_forSerialize:
Function serialize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 29
Branch analysis from position: 22
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/SggeU
function name:  serialize
number of ops:  31
compiled vars:  !0 = $ret, !1 = $v, !2 = $k, !3 = $serializedData
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   NEW                                                  $4      'stdClass'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $4
    7     3        FETCH_THIS                                           ~7      
          4      > FE_RESET_R                                           $8      ~7, ->12
          5    > > FE_FETCH_R                                           ~9      $8, !1, ->12
          6    >   ASSIGN                                                       !2, ~9
    8     7        TYPE_CHECK                                      1020          !1
          8      > JMPZ                                                         ~11, ->11
    9     9    >   ASSIGN_OBJ                                                   !0, !2
         10        OP_DATA                                                      !1
    7    11    > > JMP                                                          ->5
         12    >   FE_FREE                                                      $8
   13    13        INIT_FCALL                                                   'serialize'
         14        SEND_VAR                                                     !0
         15        DO_ICALL                                             $13     
         16        ASSIGN                                                       !3, $13
   15    17        INIT_FCALL                                                   'unserialize'
         18        SEND_VAR                                                     !3
         19        DO_ICALL                                             $15     
         20        TYPE_CHECK                                        4          $15
         21      > JMPZ                                                         ~16, ->29
   16    22    >   INIT_FCALL                                                   'var_dump'
         23        SEND_VAR                                                     !3
         24        DO_ICALL                                                     
   17    25        NEW                                                  $18     'Exception'
         26        SEND_VAL_EX                                                  'Serialize+failed'
         27        DO_FCALL                                          0          
         28      > THROW                                             0          $18
   20    29    > > RETURN                                                       !3
   21    30*     > RETURN                                                       null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/SggeU
function name:  unserialize
number of ops:  13
compiled vars:  !0 = $data, !1 = $dataObj, !2 = $v, !3 = $k
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                                             $4      
          4        ASSIGN                                                       !1, $4
   26     5      > FE_RESET_R                                           $6      !1, ->11
          6    > > FE_FETCH_R                                           ~7      $6, !2, ->11
          7    >   ASSIGN                                                       !3, ~7
   27     8        ASSIGN_OBJ                                                   !3
          9        OP_DATA                                                      !2
   26    10      > JMP                                                          ->6
         11    >   FE_FREE                                                      $6
   29    12      > RETURN                                                       null

End of function unserialize

End of class testClass_forSerialize.

Class testClass_forSerialize_02:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 2
Branch analysis from position: 10
Branch analysis from position: 2
filename:       /in/SggeU
function name:  __construct
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   38     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->8
   39     2    >   NEW                                                  $4      'testClass_forSerialize'
          3        DO_FCALL                                          0          
          4        FETCH_OBJ_W                                          $2      'list'
          5        ASSIGN_DIM                                                   $2
          6        OP_DATA                                                      $4
   38     7        PRE_INC                                                      !0
          8    >   IS_SMALLER                                                   !0, 10
          9      > JMPNZ                                                        ~7, ->2
   41    10    > > RETURN                                                       null

End of function __construct

End of class testClass_forSerialize_02.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
274.59 ms | 2892 KiB | 18 Q