CakePHP dropping session between pages

Posted by DavidYell on Stack Overflow See other posts from Stack Overflow or by DavidYell
Published on 2009-12-29T11:15:28Z Indexed on 2010/03/13 17:25 UTC
Read the original article Hit count: 199

Filed under:
|
|

Hi,

I have an application with multiple regions and various incoming links. The premise, well it worked before, is that in the app_controller, I break out these incoming links and set them in the session.

So I have a huge beforeFilter() in my *app_controller* which catches these and sets two variables in the session. Viewing.region and Search.engine, no problem.

The problem arises that the session does not seem to be persistant across page requests. So for example, going to /reviews/write (userReviews/add) should have a session available which was set when the user arrived at the site. Although it seems to have vanished!

It would appear that unless $this->params is caught explicitly in the *app_controller* and a session variable written, it does not exist on other pages.

So far I have tried, swapping between storing session in 'cake' and 'php' both seem to exhibit the same behaviour. I use 'php' as a default. My Session.timeout is '120', Session.checkAgent is False and Security.level is 'low'. All of which should give enough leniency to the framework to allow sessions the most room to live!

I'm a bit stumped as to why the session seems to be either recreated or blanked when a new page is being requested. I have commented out the requestAction() calls to make sure that isn't confusing the session request object also, which doesn't seem to make a difference.

Any help would be great, as I don't have to have to recode the site to pass all the various variables via parameters in the url, as that would suck, and it's worked before, thus switching on $this->Session->read('Viewing.region') in all my code!

© Stack Overflow or respective owner

Related posts about php

Related posts about cakephp