Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento frontend (session) cookie

Tags:

magento

i have some strange behaviour in IE on my magento shop with loosing the frontend (session) cookie. does anybody has a clue, where in the magento code the frontend cookie gets set?

Thanks!

like image 721
Thomas Avatar asked Feb 23 '23 21:02

Thomas


1 Answers

Afaik, the 'frontend' cookie gets set right before the current action is being dispatched.

Have a look at Mage_Core_Controller_Varien_Action::preDispatch().

Session start

Looking into preDispatch(), find the line which starts the session:

 Mage::getSingleton('core/session', array('name' => $namespace))->start();

Which usually (if not overridden) finally maps to

 Mage_Core_Model_Session_Abstract_Varien::start()

This is the place where all the standard session stuff gets initialized, including cookie settings by using session_set_cookie_params.

Revalidation

Be aware though, that once the cookie already exists, first cookie mangling may already happen while the core session gets instantiated, i.e. before start() is called. That's because the constructor calls revalidateCookie() while instantiating the core session. See:

 Mage_Core_Model_Session_Abstract_Varien::init()
like image 73
Jürgen Thelen Avatar answered Mar 03 '23 09:03

Jürgen Thelen