We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Session data retrieving last query made

Hello, while initiating a new session in a login, the correct session data is only being applied to it once and afterwards it takes data of the last sql query made anywhere in the application, the same goes when trying to make any query, only the last query is being made, when removing the session, the correct query is being made. The session is only initiated once in the application in the login page.

indexController.php

$this->session->set("user", $user);

services.php

$di->set('session', function () {
    $session = new SessionAdapter();
    $session = new Phalcon\Session\Adapter\Files(
        array(
            'uniqueId' => 'client-backend'
        )
    );
    if (session_status() == PHP_SESSION_NONE) {
        $session->start();
    }
    return $session;
});


98.9k

Try registering the service as shared:

$di->set('session', function () { /* ... */ }, true);

Have tried it before, doesn't seem to work :/