Session won't start when using uniqueId

Hi when I use session like that it won't start :

    define('UNIQUE_APP_ID', uniqid());

    $di->set('session', function() {

        $session = new Phalcon\Session\Adapter\Files(
            array(

                'uniqueId' => UNIQUE_APP_ID
            )
        );

        $session->start();

        return $session;
    });

But, when I do this it's working :

    $di->set('session', function() {

        $session = new Phalcon\Session\Adapter\Files();

        $session->start();

        return $session;
    });

Any ideas why ?

Thank you



83.4k
edited Jul '14

uniqid() always returns a different ID, this means that every call returns a different unique ID for every session which means it's impossible to recover the session data between one request and another.

Check how session_id works for more information on this functionality. http://php.net/manual/en/function.session-id.php