3

Is it possible to override the Session Cookie Lifetime found in the system configuration?

The reason I ask is because it appears that Magento is not honoring the value I set for Cookie Lifetime no matter what. This is an instance that MANY developers have had their hands in and it seems someone found a way to override it. Any thoughts?

  • After changing the value, have you cleared all the cache and restarted your web services to ensure the new value has taken effect? – SR_Magento Jun 12 '14 at 13:35
  • Definitely. This is happening on local instances as well. Somewhere in the code. – sparecycle Jun 12 '14 at 13:39
0

Check the content of code/core/Mage/Core/Model/Session/Abstract.php and make sure the file is used. If the lifetime is wrong, check where it is set.

-1

File

code/core/Mage/Core/Model/Session/Abstract.php

public static function buildCookie()
        {
                require_once 'app/Mage.php';
                $request = new Zend_Controller_Request_Http();
                session_set_cookie_params(
                         self::getCookieLifetime()
                        ,self::getDefaultCookiePath()
//                      ,$request->getHttpHost() // commented out to fix double cookie problem.
                        ,'.domain.com' // added to fix double cookie problem.
                        ,false
                        ,true
                );
                session_name('frontend');
                session_start();
        }
  • 2
    Modifying core files is strongly in conflict with Magento best practices. – parhamr Nov 18 '15 at 23:39
  • not best way to change core files. – denish vachhani Oct 19 '16 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.