Invalid superglobal

I'm migrating a project to PHP7.2 and Phalcon 3.3, and I'm getting this error message:

Invalid superglobal

The root of the stacktrace is this line:

        if ($this->session->has($key)) { // exception thrown here
            return $this->session->get($key);
        }

My session adapter is Redis, and i'm explicitly calling session->start() in the services file.

Any ideas?

Phalcon

  • Version => 3.3.0
  • Build Date => Dec 24 2017 11:27:36
  • Powered by Zephir => Version 0.10.5-04eb3288bf

PHP

  • PHP 7.2.0-2+ubuntu16.04.1+deb.sury.org+2 (cli)
edited Jan '18

Running this raw script:

<?php
// test.php
session_start();
$_SESSION['foo'] = 'bar';
var_dump($_SESSION);

works as expected:

$ php5.6 test.php
array(1) {
  ["foo"]=>
  string(3) "bar"
}
$ php7.2 test.php
array(1) {
  ["foo"]=>
  string(3) "bar"
}

I've ended up creating a plain PHP class by merging the zephir Phalcon\Session\Adapter and Phalcon\Session\Adapter\Redis into a single PHP file, and that solved the problem.

The code does the same in theory, so it's weird...



36.3k

Hi,

that's strange indeed. Maybe you can open an issue on github.

merging the zephir Phalcon\Session\Adapter and Phalcon\Session\Adapter\Redis into a single PHP file, and that solved the problem.

I'm really curious ... , can you elaborate what's under the hood with that ;-)

Gonna copy it over to github, here's the merged file in the meantime :]

https://gist.github.com/lajosbencz/eb6869b6987e6a3eed70a1aab3f5c6fc

edited Jan '18

I think there is a Zephir -> PHP transpiler out there, but I just rewrote these two classes by hand...



36.3k

Ah, ok. This is what I wanted to know. Thank you for answer.



10.0k

I can confirm this error with Redis sessions