3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements SessionHandlerInterface { public function close() { 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) { $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 { throw new Exception("Unexpected"); } return true; } } $test = new Test(); session_set_save_handler($test); 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/jujR7
function name:  (null)
number of ops:  20
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'test'
   44     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   45     4        INIT_FCALL                                               'session_set_save_handler'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   46     7        INIT_FCALL                                               'session_start'
          8        DO_ICALL                                                 
   47     9        INIT_FCALL                                               'session_write_close'
         10        DO_ICALL                                                 
   48    11        ECHO                                                     'none%3A+'
         12        INIT_FCALL                                               'var_dump'
         13        SEND_VAL                                                 1
         14        DO_ICALL                                                 
   49    15        ECHO                                                     'active%3A+'
         16        INIT_FCALL                                               'var_dump'
         17        SEND_VAL                                                 2
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Class Test:
Function close:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jujR7
function name:  close
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   <true>
    8     1*     > 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/jujR7
function name:  destroy
number of ops:  3
compiled vars:  !0 = $session_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1      > RETURN                                                   <true>
   13     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/jujR7
function name:  gc
number of ops:  3
compiled vars:  !0 = $maxlifetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1      > RETURN                                                   <true>
   18     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/jujR7
function name:  open
number of ops:  4
compiled vars:  !0 = $save_path, !1 = $session_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2      > RETURN                                                   <true>
   23     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/jujR7
function name:  read
number of ops:  3
compiled vars:  !0 = $session_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   27     1      > RETURN                                                   'testtest%7Cs%3A7%3A%22testing%22%3B'
   28     2*     > RETURN                                                   null

End of function read

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

End of function write

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.73 ms | 1392 KiB | 23 Q