3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements SessionHandlerInterface { public function close() { echo 'closing' . PHP_EOL; return true; } public function destroy($session_id) { return true; } public function gc($maxlifetime) { return true; } public function open($save_path, $session_name) { return true; } public function read($session_id) { return 'testtest|s:7:"testing";'; } public function write($session_id, $session_data) { echo 'writing' . PHP_EOL; $status = session_status(); if ($status === PHP_SESSION_NONE) { echo 'session is closed' . PHP_EOL; } elseif ($status === PHP_SESSION_ACTIVE) { echo 'session is active' . PHP_EOL; } else { echo 'what happened'; } return true; } } $test = new Test(); session_set_save_handler($test, true); session_start(); session_write_close(); echo 'none: '; var_dump(PHP_SESSION_NONE ); echo 'active: '; var_dump(PHP_SESSION_ACTIVE );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MB61u
function name:  (null)
number of ops:  21
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'test'
   46     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   47     4        INIT_FCALL                                               'session_set_save_handler'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                                 
   48     8        INIT_FCALL                                               'session_start'
          9        DO_ICALL                                                 
   49    10        INIT_FCALL                                               'session_write_close'
         11        DO_ICALL                                                 
   50    12        ECHO                                                     'none%3A+'
         13        INIT_FCALL                                               'var_dump'
         14        SEND_VAL                                                 1
         15        DO_ICALL                                                 
   51    16        ECHO                                                     'active%3A+'
         17        INIT_FCALL                                               'var_dump'
         18        SEND_VAL                                                 2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Class Test:
Function close:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MB61u
function name:  close
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'closing%0A'
    8     1      > RETURN                                                   <true>
    9     2*     > RETURN                                                   null

End of function close

Function destroy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MB61u
function name:  destroy
number of ops:  3
compiled vars:  !0 = $session_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1      > RETURN                                                   <true>
   14     2*     > RETURN                                                   null

End of function destroy

Function gc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MB61u
function name:  gc
number of ops:  3
compiled vars:  !0 = $maxlifetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1      > RETURN                                                   <true>
   19     2*     > RETURN                                                   null

End of function gc

Function open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MB61u
function name:  open
number of ops:  4
compiled vars:  !0 = $save_path, !1 = $session_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2      > RETURN                                                   <true>
   24     3*     > RETURN                                                   null

End of function open

Function read:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MB61u
function name:  read
number of ops:  3
compiled vars:  !0 = $session_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   28     1      > RETURN                                                   'testtest%7Cs%3A7%3A%22testing%22%3B'
   29     2*     > RETURN                                                   null

End of function read

Function write:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MB61u
function name:  write
number of ops:  17
compiled vars:  !0 = $session_id, !1 = $session_data, !2 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   33     2        ECHO                                                     'writing%0A'
   34     3        INIT_FCALL                                               'session_status'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
   35     6        IS_IDENTICAL                                             !2, 1
          7      > JMPZ                                                     ~5, ->10
   36     8    >   ECHO                                                     'session+is+closed%0A'
          9      > JMP                                                      ->15
   37    10    >   IS_IDENTICAL                                             !2, 2
         11      > JMPZ                                                     ~6, ->14
   38    12    >   ECHO                                                     'session+is+active%0A'
         13      > JMP                                                      ->15
   40    14    >   ECHO                                                     'what+happened'
   42    15    > > RETURN                                                   <true>
   43    16*     > RETURN                                                   null

End of function write

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.56 ms | 1400 KiB | 23 Q