Wednesday, June 30, 2010

Re: Session data not being displayed

Very strange - can you put up the code from a controller where the
session does work? I'm assuming they're identical - or they should be.

Also it might be a case of overkill by using both:

App::import('Core', 'l10n', 'Sanitize', 'CakeSession');

And:

public $components = array('Session','Cookie','ControllerList');

I don't think you need 'CakeSession' in the app:import as you already
have it as an included component?

On Jun 30, 10:49 am, Taff <taff.law...@googlemail.com> wrote:
> Using my app_controller I am trying to debug my session data. In all
> my controllers I am receiving
> Array
> (
>     [Config] => Array
>         (
>             [userAgent] => c03e2e173822ed9de51b506bf80e16f8
>             [time] => 1277726475
>             [timeout] => 300
>         )
> )
> which is correct but 1 which is returning empty. I am not changing my
> components array in the entries_controller.php (the one that isn't
> working).
>
> I have beenhunting since yesterday trying to find the root of the
> problem and have no idea where else to look.
> My app_controller looks like this:
>
> <?php
> App::import('Core', 'l10n', 'Sanitize', 'CakeSession');
> class AppController extends Controller {
>
>         public $components = array('Session','Cookie','ControllerList');
>
>         function beforeFilter() {
>         parent::beforeFilter();
>                 debug($this->Session->read());//returns all Session information
>         }
>
> }
>
> and my entries_controller looks like:
>
> class EntriesController extends AppController {
>
>         var $name = 'Entries';
>
>         function index() {
>                 $this->Session->write("test",2);
>                 debug($this->Session->read());
>         }
>
> }
>
> The second problem is that setting the session variable "test" to 2
> works but only in that controller.
>
> Has anybody got any ideas where I should start looking for the
> solution to the problem?
> I really am pulling out my hair :-)
>
> After searching the group I have checked and session.auto_start is set
> to 0
>
> Cheers,
> Taff

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: