3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SessionSaveHandler { /** * Constructs the object */ public function __construct() { /** * Register the functions */ session_set_save_handler( array($this, "open"), array($this, "close"), array($this, "read"), array($this, "write"), array($this, "destroy"), array($this, "gc") ); /** * To call the write process before the object cache is destroyed */ register_shutdown_function('session_write_close'); } /** * Opens a connection - Not in use * * @param string $savePath * @param string $sessionName * @return boolean */ public function open($savePath, $sessionName) { return true; } /** * Closing the connection - Not in use * * @return boolean */ public function close() { return true; } /** * Returns the datas for the given session id * * @global WP_Object_Cache $wp_object_cache * @param string $id * @return mixed */ public function read($id) { global $memcachedConnection; return $memcachedConnection->get($this->prepareId($id)); } /** * Saves the datas for the given session id * * @global WP_Object_Cache $wp_object_cache * @param string $id * @param mixed $data */ public function write($id, $data) { global $memcachedConnection; $memcachedConnection->set($this->prepareId($id), $data, 3600); return true; } /** * Deletes the data for the given session id * * @global WP_Object_Cache $wp_object_cache * @param string $id */ public function destroy($id) { global $memcachedConnection; $memcachedConnection->delete($this->prepareId($id)); return true; } /** * Garbage collection - not in use - we have no garbage! * * @param integer $maxlifetime * @return boolean */ public function gc($maxlifetime) { return true; } /** * Returns the id with a prefix * * @param string $id * @return string */ protected function prepareId($id) { return 'SMK_' . md5($_SERVER['SERVER_NAME']) . '_SESSION_' . $id; } } /** * Creates the object and register the new session handler */ $sessionHandler = new SessionSaveHandler();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXc7q
function name:  (null)
number of ops:  4
compiled vars:  !0 = $sessionHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  121     0  E >   NEW                                              $1      'SessionSaveHandler'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3      > RETURN                                                   1

Class SessionSaveHandler:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXc7q
function name:  __construct
number of ops:  30
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'session_set_save_handler'
   14     1        FETCH_THIS                                       ~0      
          2        INIT_ARRAY                                       ~1      ~0
          3        ADD_ARRAY_ELEMENT                                ~1      'open'
          4        SEND_VAL                                                 ~1
   15     5        FETCH_THIS                                       ~2      
          6        INIT_ARRAY                                       ~3      ~2
          7        ADD_ARRAY_ELEMENT                                ~3      'close'
          8        SEND_VAL                                                 ~3
   16     9        FETCH_THIS                                       ~4      
         10        INIT_ARRAY                                       ~5      ~4
         11        ADD_ARRAY_ELEMENT                                ~5      'read'
         12        SEND_VAL                                                 ~5
   17    13        FETCH_THIS                                       ~6      
         14        INIT_ARRAY                                       ~7      ~6
         15        ADD_ARRAY_ELEMENT                                ~7      'write'
         16        SEND_VAL                                                 ~7
   18    17        FETCH_THIS                                       ~8      
         18        INIT_ARRAY                                       ~9      ~8
         19        ADD_ARRAY_ELEMENT                                ~9      'destroy'
         20        SEND_VAL                                                 ~9
   19    21        FETCH_THIS                                       ~10     
         22        INIT_ARRAY                                       ~11     ~10
         23        ADD_ARRAY_ELEMENT                                ~11     'gc'
         24        SEND_VAL                                                 ~11
         25        DO_ICALL                                                 
   25    26        INIT_FCALL                                               'register_shutdown_function'
         27        SEND_VAL                                                 'session_write_close'
         28        DO_ICALL                                                 
   26    29      > 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/PXc7q
function name:  open
number of ops:  4
compiled vars:  !0 = $savePath, !1 = $sessionName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   37     2      > RETURN                                                   <true>
   38     3*     > RETURN                                                   null

End of function open

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

End of function close

Function read:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXc7q
function name:  read
number of ops:  10
compiled vars:  !0 = $id, !1 = $memcachedConnection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   RECV                                             !0      
   59     1        BIND_GLOBAL                                              !1, 'memcachedConnection'
   61     2        INIT_METHOD_CALL                                         !1, 'get'
          3        INIT_METHOD_CALL                                         'prepareId'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR_NO_REF_EX                                       $2
          7        DO_FCALL                                      0  $3      
          8      > RETURN                                                   $3
   62     9*     > 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/PXc7q
function name:  write
number of ops:  13
compiled vars:  !0 = $id, !1 = $data, !2 = $memcachedConnection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   71     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   73     2        BIND_GLOBAL                                              !2, 'memcachedConnection'
   75     3        INIT_METHOD_CALL                                         !2, 'set'
          4        INIT_METHOD_CALL                                         'prepareId'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR_NO_REF_EX                                       $3
          8        SEND_VAR_EX                                              !1
          9        SEND_VAL_EX                                              3600
         10        DO_FCALL                                      0          
   77    11      > RETURN                                                   <true>
   78    12*     > 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/PXc7q
function name:  destroy
number of ops:  10
compiled vars:  !0 = $id, !1 = $memcachedConnection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   86     0  E >   RECV                                             !0      
   88     1        BIND_GLOBAL                                              !1, 'memcachedConnection'
   90     2        INIT_METHOD_CALL                                         !1, 'delete'
          3        INIT_METHOD_CALL                                         'prepareId'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR_NO_REF_EX                                       $2
          7        DO_FCALL                                      0          
   92     8      > RETURN                                                   <true>
   93     9*     > 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/PXc7q
function name:  gc
number of ops:  3
compiled vars:  !0 = $maxlifetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  101     0  E >   RECV                                             !0      
  103     1      > RETURN                                                   <true>
  104     2*     > RETURN                                                   null

End of function gc

Function prepareid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXc7q
function name:  prepareId
number of ops:  11
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  112     0  E >   RECV                                             !0      
  114     1        INIT_FCALL                                               'md5'
          2        FETCH_R                      global              ~1      '_SERVER'
          3        FETCH_DIM_R                                      ~2      ~1, 'SERVER_NAME'
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                         $3      
          6        CONCAT                                           ~4      'SMK_', $3
          7        CONCAT                                           ~5      ~4, '_SESSION_'
          8        CONCAT                                           ~6      ~5, !0
          9      > RETURN                                                   ~6
  115    10*     > RETURN                                                   null

End of function prepareid

End of class SessionSaveHandler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.77 ms | 1404 KiB | 19 Q