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

Exception: Invalid superglobal

Hello Community,

This is my 3rd day using Phalcon.

My Phalcon version is: 3.3.1

I have the following from https://docs.phalcon.io/fr/3.3/session

//in public\index.php

use Phalcon\Session\Adapter\Files as Session;

//I also tried $di->setShared - same error

$di->set('session', function () { $session = new Session(); $session->start(); return $session; } );

//in Controller

$this->session->set('user-name', 'xyz');

if ($this->session->has('user-name')) { // Retrieve its value $name = $this->session->get('user-name'); echo $name; }

I get the output: Exception: Invalid superglobal

How can I get around this?

edited Feb '18

Hello,

I tried the folowing in public/index.php

use Phalcon\Mvc\Micro as Micro;

$app = new Micro($di);

echo $app->handle()->getContent();

But I get:

Exception: Matched route doesn't have an associated handler

Which is confusing since I have not changed any routes.