3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Session_Database{ public function close(){} } class Session { private Session_Database $db; public function __construct(){ // Instantiate new Database object $this->db = new Session_Database(); // Set handler to overide SESSION session_set_save_handler( [$this, '_open'], [$this, '_close'], [$this, '_read'], [$this, '_write'], [$this, '_destroy'], [$this, '_gc'] ); // Start the session session_start(); } public function _open(string $savePath, string $sessionName): bool {return true;} public function _read(string $sessionId): string {return '';} public function _write(string $sessionId, string $data): bool {return true;} public function _destroy(string $sessionId): bool {return true;} public function _gc(int $lifetime): bool {return true;} public function _close(): bool { echo 'closing session'; // Close the database connection $this->db->close(); return true; } } new Session; session_write_close();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WfN3S
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   42     0  E >   NEW                                                  $0      'Session'
          1        DO_FCALL                                          0          
          2        FREE                                                         $0
   43     3        INIT_FCALL                                                   'session_write_close'
          4        DO_ICALL                                                     
          5      > RETURN                                                       1

Class Session_Database:
Function close:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WfN3S
function name:  close
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                       null

End of function close

End of class Session_Database.

Class Session:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WfN3S
function name:  __construct
number of ops:  33
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   NEW                                                  $1      'Session_Database'
          1        DO_FCALL                                          0          
          2        ASSIGN_OBJ                                                   'db'
          3        OP_DATA                                                      $1
   15     4        INIT_FCALL                                                   'session_set_save_handler'
   16     5        FETCH_THIS                                           ~3      
          6        INIT_ARRAY                                           ~4      ~3
          7        ADD_ARRAY_ELEMENT                                    ~4      '_open'
          8        SEND_VAL                                                     ~4
   17     9        FETCH_THIS                                           ~5      
         10        INIT_ARRAY                                           ~6      ~5
         11        ADD_ARRAY_ELEMENT                                    ~6      '_close'
         12        SEND_VAL                                                     ~6
   18    13        FETCH_THIS                                           ~7      
         14        INIT_ARRAY                                           ~8      ~7
         15        ADD_ARRAY_ELEMENT                                    ~8      '_read'
         16        SEND_VAL                                                     ~8
   19    17        FETCH_THIS                                           ~9      
         18        INIT_ARRAY                                           ~10     ~9
         19        ADD_ARRAY_ELEMENT                                    ~10     '_write'
         20        SEND_VAL                                                     ~10
   20    21        FETCH_THIS                                           ~11     
         22        INIT_ARRAY                                           ~12     ~11
         23        ADD_ARRAY_ELEMENT                                    ~12     '_destroy'
         24        SEND_VAL                                                     ~12
   21    25        FETCH_THIS                                           ~13     
         26        INIT_ARRAY                                           ~14     ~13
         27        ADD_ARRAY_ELEMENT                                    ~14     '_gc'
         28        SEND_VAL                                                     ~14
   15    29        DO_ICALL                                                     
   25    30        INIT_FCALL                                                   'session_start'
         31        DO_ICALL                                                     
   26    32      > RETURN                                                       null

End of function __construct

Function _open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WfN3S
function name:  _open
number of ops:  5
compiled vars:  !0 = $savePath, !1 = $sessionName
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2      > RETURN                                                       <true>
          3*       VERIFY_RETURN_TYPE                                           
          4*     > 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/WfN3S
function name:  _read
number of ops:  4
compiled vars:  !0 = $sessionId
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   29     0  E >   RECV                                                 !0      
          1      > RETURN                                                       ''
          2*       VERIFY_RETURN_TYPE                                           
          3*     > RETURN                                                       null

End of function _read

Function _write:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WfN3S
function name:  _write
number of ops:  5
compiled vars:  !0 = $sessionId, !1 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2      > RETURN                                                       <true>
          3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function _write

Function _destroy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WfN3S
function name:  _destroy
number of ops:  4
compiled vars:  !0 = $sessionId
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   RECV                                                 !0      
          1      > RETURN                                                       <true>
          2*       VERIFY_RETURN_TYPE                                           
          3*     > 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/WfN3S
function name:  _gc
number of ops:  4
compiled vars:  !0 = $lifetime
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   RECV                                                 !0      
          1      > RETURN                                                       <true>
          2*       VERIFY_RETURN_TYPE                                           
          3*     > RETURN                                                       null

End of function _gc

Function _close:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WfN3S
function name:  _close
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   ECHO                                                         'closing+session'
   37     1        FETCH_OBJ_R                                          ~0      'db'
          2        INIT_METHOD_CALL                                             ~0, 'close'
          3        DO_FCALL                                          0          
   38     4      > RETURN                                                       <true>
   39     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function _close

End of class Session.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.11 ms | 1606 KiB | 16 Q