Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getFrontController causing 404 #166

Open
rcurrington opened this issue Jun 28, 2019 · 5 comments
Open

getFrontController causing 404 #166

rcurrington opened this issue Jun 28, 2019 · 5 comments

Comments

@rcurrington
Copy link

After upgrading from an older version to the current version, our store went into 404 mode where it would only produce 404's for every page. After digging in, it appears to be from the change where getFrontController was added to the session handler constructor.

$this->sessionHandler = new \Cm\RedisSession\Handler(
new Cm_RedisSession_Model_Session_Config(),
new Cm_RedisSession_Model_Session_Logger(),
Mage::app()->getFrontController()->getAction() && Mage::app()->getFrontController()->getAction()->getFlag('', self::FLAG_READ_ONLY) ?: false
);

Simply calling Mage::app()->getFrontController() causes the site to 404. We are using amasty fpc, and I suspect it has something to do with that.

@colinmollenhour
Copy link
Owner

That's one of the problems with the lazy-load pattern.. However I noticed that _initFrontController registers the controller in the registry so that could be used to check to see if the front controller exists.

Please try changing it to something like this and if it fixes it a PR would be appreciated:

$this->sessionHandler = new \Cm\RedisSession\Handler(
    new Cm_RedisSession_Model_Session_Config(),
    new Cm_RedisSession_Model_Session_Logger(),
    Mage::registry('controller') && Mage::app()->getFrontController()->getAction() && Mage::app()->getFrontController()->getAction()->getFlag('', self::FLAG_READ_ONLY) ?: false
);

@rcurrington
Copy link
Author

rcurrington commented Jul 1, 2019 via email

@colinmollenhour
Copy link
Owner

Right, whatever code is trying to init the session, it should not be doing so unless the app is already inited. Maybe it worked before, but it seems like a bad thing to do either way.

@rcurrington
Copy link
Author

rcurrington commented Jul 1, 2019 via email

@colinmollenhour
Copy link
Owner

Perhaps we modify the logger to not log an exception if getStore() fails?

An exception should not be thrown if it is just to be ignored. I've pushed an update to not init the front controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants