PHP Session with an Incomplete Object


Omg what a headache i got from this one…

if you ever encountered yourself trying to retrieve an object from the session and got this message:

object(__PHP_Incomplete_Class)#1 (2) { [“__PHP_Incomplete_Class_Name”]… etc

That means that you started the session BEFORE including the class of the object that you have stored in the session, so php can’t find the class of the object.

To solve this, simply make sure session_start() is called AFTER any include and after you register your custom autoloaders.

 

Advertisements