Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Session becomes null

I have the same issue as https://forum.phalconphp.com/discussion/842/session-auth-become-null-when-i-change-url-manually where the session goes null after first time login how can I solve this?

Hey, could you paste your session code from your startup file. Its usually in index.php

Mine looks like this:

    // session
    $di->setShared('session', function() {
        $session = new \Phalcon\Session\Adapter\Files();
        $session->start();
        return $session;
    });  


419
edited Nov '15

I am using the same session as INVO project.

first I use :

$di->setShared('session', function () {
    $session = new SessionAdapter();        
    $session->start();

    return $session;
});

then I set the variables:

$this->session->set('auth', array(
            'id' => $user->userid,
            'name' => $user->username
        ));

then access it in acl:

$auth = $this->session->get('auth');

when I access the session in the acl the second time auth is null



419
Accepted
answer

I got the problem.

i removed $this->session->destroy(); in the Security plugin