Do var_dump(session_get_cookie_params()) at the end of your bootstrap
If you have :
'lifetime' => int 1209600 then it is working.

If I call Zend_Session::rememberMe() in my authController I have
'lifetime' => int 0 which mean the cookie will die when the browser get closed.

Steven Brown a écrit :
Yes it definitely works, I login (ticking remember me), close the browser,
open the browser again and it remembers me.

I thought I had to set remember me before starting the session however I
found someone else had done the same as I have, and on testing it works.

I wonder is the cookie set only when needed, or is the remember me cookie
set on the next request, which may be caused by my redirect?

-----Original Message-----
From: Laurent Melmoux [mailto:[EMAIL PROTECTED] Sent: Friday, 7 December 2007 5:35 PM
To: Steven Brown
Cc: 'Darby Felton'; 'Zend Framework General'
Subject: Re: [fw-general] Zend_Session::start() and remember me

Are you sure it is working? Zend_Session::rememberMe() is calling Zend_Session::rememberUntil() which is calling the php function session_set_cookie_params () (http://php.net/session_set_cookie_params) . This function configures the cookie use by the session. As Darby said it should be called before session_start() to work.

Finally here is how I solve this issue:

*In my AuthController, after a successful authentification :*

// Set a cookie to notify the bootstrap how long the session cookie should last
$duration = $this->_form->rememberme ? 1209600 : 0;
setcookie("Zend_Auth_RememberMe", $duration, time()+6000, '/');

*In my bootstrap:*

// Session
include 'Zend/Session.php';
if(isset($_COOKIE["Zend_Auth_RememberMe"])){
Zend_Session::rememberUntil($_COOKIE["Zend_Auth_RememberMe"]);
unset($_COOKIE["Zend_Auth_RememberMe"]);
}
Zend_Session::start();

Regards,



--
Laurent Melmoux - [EMAIL PROTECTED]
Annecy - France

Reply via email to