3v4l.org

run code in 500+ PHP versions simultaneously
<?php $info = new SplFileInfo( __FILE__ ); try { serialize($info); } catch (\Throwable $e) { echo $e . "\n\n\n"; } class MyFileInfo extends SplFileInfo { public function __serialize(): array { return [ 'file' => getPathname(), ]; } public function __unserialize(array $data) { $this->__construct($data['file']); } } $info2 = new MyFileInfo( __FILE__ ); try { $serialized = serialize($info2); $roundtrip = unserialize($serialized); var_dump($info2, $roundtrip); } catch (\Throwable $e) { echo $e . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Found catch point at position: 28
Branch analysis from position: 28
2 jumps found. (Code = 107) Position 1 = 29, Position 2 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SVqho
function name:  (null)
number of ops:  32
compiled vars:  !0 = $info, !1 = $e, !2 = $info2, !3 = $serialized, !4 = $roundtrip
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $5      'SplFileInfo'
          1        SEND_VAL_EX                                                  '%2Fin%2FSVqho'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $5
    5     4        INIT_FCALL                                                   'serialize'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                                     
          7      > JMP                                                          ->11
    6     8  E > > CATCH                                           last         'Throwable'
    7     9    >   CONCAT                                               ~9      !1, '%0A%0A%0A'
         10        ECHO                                                         ~9
   22    11    >   NEW                                                  $10     'MyFileInfo'
         12        SEND_VAL_EX                                                  '%2Fin%2FSVqho'
         13        DO_FCALL                                          0          
         14        ASSIGN                                                       !2, $10
   24    15        INIT_FCALL                                                   'serialize'
         16        SEND_VAR                                                     !2
         17        DO_ICALL                                             $13     
         18        ASSIGN                                                       !3, $13
   25    19        INIT_FCALL                                                   'unserialize'
         20        SEND_VAR                                                     !3
         21        DO_ICALL                                             $15     
         22        ASSIGN                                                       !4, $15
   26    23        INIT_FCALL                                                   'var_dump'
         24        SEND_VAR                                                     !2
         25        SEND_VAR                                                     !4
         26        DO_ICALL                                                     
         27      > JMP                                                          ->31
   27    28  E > > CATCH                                           last         'Throwable'
   28    29    >   CONCAT                                               ~18     !1, '%0A'
         30        ECHO                                                         ~18
   29    31    > > RETURN                                                       1

Class MyFileInfo:
Function __serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SVqho
function name:  __serialize
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL_BY_NAME                                           'getPathname'
          1        DO_FCALL                                          0  $0      
          2        INIT_ARRAY                                           ~1      $0, 'file'
          3        VERIFY_RETURN_TYPE                                           ~1
          4      > RETURN                                                       ~1
   15     5*       VERIFY_RETURN_TYPE                                           
          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/SVqho
function name:  __unserialize
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   18     1        INIT_METHOD_CALL                                             '__construct'
          2        CHECK_FUNC_ARG                                               
          3        FETCH_DIM_FUNC_ARG                                   $1      !0, 'file'
          4        SEND_FUNC_ARG                                                $1
          5        DO_FCALL                                          0          
   19     6      > RETURN                                                       null

End of function __unserialize

End of class MyFileInfo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.42 ms | 1110 KiB | 16 Q