• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
maybe need to modify session garbage collector section.

#1
I think that maybe need to modify session garbage collector section.

Session/Handlers/FileHandler.php
public function gc();

original code is ...

$pattern = sprintf(
  '/^%s[0-9a-f]{%d}$/', preg_quote($this->cookieName, '/'), ($this->matchIP === true ? 72 : 40)
);


but, why 40? I can't understand this.

for example, one of my session file name is a_sessionba2o0ekqqv8ogvqonrl2u0uqg86so8fm
a_session is cookiename.
so, session id is "ba2o0ekqqv8ogvqonrl2u0uqg86so8fm". the length of this string is 32.

So, actually, in my case 32 is correct value.
and I found this code part.

in Session/Session.php
protected function configureSidLength();

after be called this function, sidRegexp value is, "[0-9a-v]{32}" (in my case)

So, I tried to modify gc part code.

Here are some code.

PHP Code:
       $sid_regexp '';
 
       $bits_per_character = (int) (ini_get('session.sid_bits_per_character') !== false ini_get('session.sid_bits_per_character') : 4);
 
       $sid_length = (int) (ini_get('session.sid_length') !== false ini_get('session.sid_length') : 40);
 
       switch ($bits_per_character) {
 
           case 4$sid_regexp '[0-9a-f]'; break;
 
           case 5$sid_regexp '[0-9a-v]'; break;
 
           case 6$sid_regexp '[0-9a-zA-Z,-]'; break;
 
       }
 
       $sid_regexp .= '{' $sid_length '}';
 
       $pattern sprintf'/^%s%s$/'preg_quote($this->cookieName'/'), $sid_regexp );

 
       /* // Original Code
        $pattern = sprintf(
                '/^%s[0-9a-f]{%d}$/', preg_quote($this->cookieName, '/'), ($this->matchIP === true ? 72 : 40)
    );*/ 


After modify it, Finally My php Garbage Collector removed garbage session files.

So, please modify this part properly.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.