Hi there, i seem to be having a problem with a session namespace
problem, and non cookie and cookie sessions. Basically Im going to a
"check" action on the script which has a temporary session attached like
/index/check?client=502850935809325825039523, when I check that the
session is active however, collect its data , and then destroy it to
create a permanent cookie session it simply wont work when i redirect
back to the index controller the cookie session is empty. I had to get
it working again by using the raw php functions only, the zend session
classes simply do not work. Code below. Basically the start of check has
session options for the non cookie session. Then when its destroyed
another set of session options are made for the cookie session, when its
redirected , the session is empty but the cookie is set.
public function indexAction()
{
try {
$config = Zend_Registry::get('config');
Zend_Session::setOptions($config->session->toArray());
Zend_Session::start();
//Zend_Session::rememberMe(172800);
} catch (Zend_Session_Exception $e) {
var_dump($e);
}
//Zend_Session::regenerateId();
$this->session = new Zend_Session_Namespace('space');
if ($this->session->isLocked()) {
$this->session->unLock();
}
}
public function checkAction()
{
$this->_helper->viewRenderer->setNoRender();
try {
$config = Zend_Registry::get('config');
Zend_Session::setOptions($config->keySession->toArray());
Zend_Session::start();
$this->session = new Zend_Session_Namespace('client');
$this->session->setExpirationSeconds(10);
$this->session->setExpirationHops(1);
} catch (Zend_Session_Exception $e) {
var_dump($e);
}
if ($this->session->customerID)
{
$customerID = $this->session->customerID;
Zend_Session::destroy(true,false);
try {
Zend_Session::setOptions($config->session->toArray());
Zend_Session::start();
//Zend_Session::rememberMe(172800);
//Zend_Session::regenerateId();
$this->session = new
Zend_Session_Namespace('space');
if ($this->session->isLocked()) {
$this->session->unLock();
}
// $this->session->lock();
// } catch (Zend_Session_Exception $e) {
var_dump($e);
}
$this->session->customerID = $customerID;
$this->_redirector->gotoUrl('/');
return;
}
}