3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MemcacheSessionModule /*implements \SessionHandlerInterface */ { const UNIX_PREFIX = 'unix://'; const FILE_PREFIX = 'file://'; /** * Our Memcache Pool * @var Memcache */ private $pool; public function close() { if ($this->pool instanceof Memcache) { return $this->pool->close(); } return true; } public function destroy($sessionId) { } public function gc($maxLifetime) { } public function open($savePath, $name) { $serverList = self::parseSavePath($savePath); if (!$serverList) { return false; } foreach ($serverList as $serverInfo) { } } public function read($sessionId) { } public function write($sessionId, $data) { } private static function parseSavePath($savePath) { if (empty($savePath)) { trigger_error( "Failed to parse session.save_path (empty save_path)", E_WARNING); return false; } $return = array(); $serverList = explode(',', $savePath); foreach ($serverList as $url) { // Swap unix:// to file:// for parse_url if (strtolower(substr($url, 0, strlen(self::UNIX_PREFIX))) === self::UNIX_PREFIX) { $url = self::FILE_PREFIX . substr($url, strlen(self::UNIX_PREFIX)); } $parsedUrlData = parse_url($url); var_dump($parsedUrlData); } } } $session = new MemcacheSessionModule; $session->open('unix:///var/run/memcache.sock?weight=123,tcp://127.0.0.1:11211?weight=1&persistent=1&timeout=4');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UXle0
function name:  (null)
number of ops:  7
compiled vars:  !0 = $session
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   71     0  E >   NEW                                              $1      'MemcacheSessionModule'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   72     3        INIT_METHOD_CALL                                         !0, 'open'
          4        SEND_VAL_EX                                              'unix%3A%2F%2F%2Fvar%2Frun%2Fmemcache.sock%3Fweight%3D123%2Ctcp%3A%2F%2F127.0.0.1%3A11211%3Fweight%3D1%26persistent%3D1%26timeout%3D4'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class MemcacheSessionModule:
Function close:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UXle0
function name:  close
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      'pool'
          1        INSTANCEOF                                               ~0, 'Memcache'
          2      > JMPZ                                                     ~1, ->7
   16     3    >   FETCH_OBJ_R                                      ~2      'pool'
          4        INIT_METHOD_CALL                                         ~2, 'close'
          5        DO_FCALL                                      0  $3      
          6      > RETURN                                                   $3
   18     7    > > RETURN                                                   <true>
   19     8*     > 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/UXle0
function name:  destroy
number of ops:  2
compiled vars:  !0 = $sessionId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1      > 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/UXle0
function name:  gc
number of ops:  2
compiled vars:  !0 = $maxLifetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   27     1      > RETURN                                                   null

End of function gc

Function open:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/UXle0
function name:  open
number of ops:  14
compiled vars:  !0 = $savePath, !1 = $name, !2 = $serverList, !3 = $serverInfo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   30     2        INIT_STATIC_METHOD_CALL                                  'parseSavePath'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !2, $4
   31     6        BOOL_NOT                                         ~6      !2
          7      > JMPZ                                                     ~6, ->9
   32     8    > > RETURN                                                   <false>
   34     9    > > FE_RESET_R                                       $7      !2, ->12
         10    > > FE_FETCH_R                                               $7, !3, ->12
         11    > > JMP                                                      ->10
         12    >   FE_FREE                                                  $7
   37    13      > 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/UXle0
function name:  read
number of ops:  2
compiled vars:  !0 = $sessionId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
   41     1      > 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/UXle0
function name:  write
number of ops:  3
compiled vars:  !0 = $sessionId, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   45     2      > RETURN                                                   null

End of function write

Function parsesavepath:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 40
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 40
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 32
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/UXle0
function name:  parseSavePath
number of ops:  42
compiled vars:  !0 = $savePath, !1 = $return, !2 = $serverList, !3 = $url, !4 = $parsedUrlData
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
   48     1        ISSET_ISEMPTY_CV                                         !0
          2      > JMPZ                                                     ~5, ->8
   49     3    >   INIT_FCALL                                               'trigger_error'
   50     4        SEND_VAL                                                 'Failed+to+parse+session.save_path+%28empty+save_path%29'
   51     5        SEND_VAL                                                 2
          6        DO_ICALL                                                 
   52     7      > RETURN                                                   <false>
   55     8    >   ASSIGN                                                   !1, <array>
   57     9        INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '%2C'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !2, $8
   58    14      > FE_RESET_R                                       $10     !2, ->40
         15    > > FE_FETCH_R                                               $10, !3, ->40
   60    16    >   INIT_FCALL                                               'strtolower'
         17        INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !3
         19        SEND_VAL                                                 0
         20        SEND_VAL                                                 7
         21        DO_ICALL                                         $11     
         22        SEND_VAR                                                 $11
         23        DO_ICALL                                         $12     
   61    24        IS_IDENTICAL                                             $12, 'unix%3A%2F%2F'
         25      > JMPZ                                                     ~13, ->32
   62    26    >   INIT_FCALL                                               'substr'
         27        SEND_VAR                                                 !3
         28        SEND_VAL                                                 7
         29        DO_ICALL                                         $14     
         30        CONCAT                                           ~15     'file%3A%2F%2F', $14
         31        ASSIGN                                                   !3, ~15
   65    32    >   INIT_FCALL                                               'parse_url'
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                         $17     
         35        ASSIGN                                                   !4, $17
   66    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !4
         38        DO_ICALL                                                 
   58    39      > JMP                                                      ->15
         40    >   FE_FREE                                                  $10
   68    41      > RETURN                                                   null

End of function parsesavepath

End of class MemcacheSessionModule.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.38 ms | 1404 KiB | 25 Q