Nette\InvalidStateException session_start(): Function spl_autoload_call() hasn't defined the class it was call

4 years ago

bazo
Member | 625
+
0
-

PHP 5.6.4–1~dotdeb.1
nginx/1.6.2
opera 12.17

nette dev-master 966412af50f62db12b9c1bfc52c5f404265d5b46 pre 2.3beta

when accessing our app from Opera browser, nette throws this exception when initializing session

public function initialize()
5755:        {
5756:            date_default_timezone_set('Europe/Bratislava');
5757:            $this->getByType("Nette\Http\Session")->start();

when accessing the app from firefox or chrome, everything works ok

has anyone ever experienced this error? because i have no idea what it means and how to fix this.

Last edited by bazo (2015-02-09 17:16)

4 years ago

David Grudl
Nette Core | 6850
+
0
-

I guess you stored object to session and when session is started, required class is not loaded.

4 years ago

bazo
Member | 625
+
0
-

i can't recall anything special being stored in the session. it happens when the visitor is not logged in.
just visits the app with old opera and bum – server error. so there was no chance to store anything in the session.

4 years ago

Jan Tvrdík
Nette guru | 2556
+
0
-

@bazo What is the value of ini_get('unserialize_callback_func')? You may also use this the determine the problematic class:

ini_set('unserialize_callback_func', 'foobar');
function foobar($class) {
    var_dump($class);
}

4 years ago

bazo
Member | 625
+
0
-

the value is spl_autoload_call

i managed to dump only one class that was ntities\Proxies\__CG__\User from doctrine

after i changed the unserialize func the page loaded ok and the app works well

even after i deleted the ini_set call it suddenly works ok

very weird situation

4 years ago

enumag
Member | 2128
+
0
-

@bazo Putting Doctrine entities into session is not a good idea. The proxy classes probably can't be autoloaded or something similar is the issue here. This article might help you.

4 years ago

bazo
Member | 625
+
0
-

there were no entities in session. there was nothing in session because the particular user visited the site for the first time. and we don't save any entities in the session.