I've created a Zend Framework Website App session intensive.
It works great in Chrome and Firefox but it is not working in IE. The session resets every page in IE.
Looking into the headers I find that IE browser is getting a different phpsessid cookie in every get or post within the same browser so the session is not working. In FF and Chrome the phpsessid cookie persists ok.
Anyone knows why this can happend only in IE?
I have this code in bootstrap.php:
$generalSession = new Zend_Session_Namespace('MyNameHere');
$generalSession ->setExpirationSeconds(1000 * 60);
I recover the session using:
Zend_Auth::getInstance()->getStorage()->read();
My IE configuration for privacy and security is set to minimum, using IE9.
I've tryed placing a p3p cookie in the headers but it made no difference.
What am I missing?
I've finally solved the problem with IE.
The thing was that our dev server was dev_landing.mysite.com and IE rejects headers from sites with "_" in their names... this is by design in IE.
I found the complete explanation here: http://odedpeer.blogspot.com.es/2009/08/why-are-my-http-cookies-rejected-by-ie.html
Keep doing!!
all you need to make sure the session starts in ZF1 is:
//in bootstrap.php
protected function _initsession()
{
Zend_Session::start();
}
This will initialize the session just like in vanilla PHP.
Unless you are changing it elsewhere Zend_Auth uses the Zend_Session_Namespace('Zend_Auth'); so any namespace you create will not be accessible to Zend_Auth.
When you create an instance of Zend_Session_Namespace() the session will started if it hasn't already been started.
I have to wonder if everytime your boostrap.php runs (every request) that Zend_Session_Namespace() call if you don't get a new session id in explorer. Maybe try and just call start in the bootstrap and just instantiate the namespaces when needed. It's also possible that some code/information not present in your question is affecting the session.
A lot of guessing going on here, so good luck.
来源:https://stackoverflow.com/questions/14048499/zend-framework-internet-explorer-phpsessid-cookie-issue