Re: LiveUser - session_set_cookie_params()

From: Date: Thu, 07 Jul 2005 02:59:03 +0000
Subject: Re: LiveUser - session_set_cookie_params()
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-38471@lists.php.net to get a copy of this message
Koistya `Navin wrote:
I thinks there is a bug in session_set_cookie_params() - LiveUser.php, line: 906 At least this way it doesn't work with IE. Original code:
       if ($this->_options['session_cookie_params']) {
           session_set_cookie_params((
               time() + (LIVEUSER_DAY_SECONDS *
$this->_options['session_cookie_params']['lifetime'])),
               $this->_options['session_cookie_params']['path'],
               $this->_options['session_cookie_params']['domain'],
               $this->_options['session_cookie_params']['secure']);
       }
Change suggestion:
       if ($this->_options['session_cookie_params']) {
           session_set_cookie_params(
               (60 * 60 * 24 *
$this->_options['session_cookie_params']['lifetime']),
               $this->_options['session_cookie_params']['path'],
               $this->_options['session_cookie_params']['domain'],
               $this->_options['session_cookie_params']['secure']);
       }
Hi,
I changed it to hardcoded number of seconds, 86400 for a day as it will not likely change. I'm cc'ing LU list as they may have a reason for the constant for which I am unaware. For the record, I don't see the added value in using a constant (as we know constants are slow) when the number of seconds in a day will not change in the near future. Doing the math 60*60*24 at every file load seems like a waste. Arnaud.

« previous php.pear.dev (#38471) next »