0

Zend Framework 2 is not letting me use orginal PHP session. I am using Responsive File Manager Application that is in public folder of zend framework 2. Whenever the dialog of file manager opens, I get following error.

Warning: Class __PHP_Incomplete_Class has no unserializer in E:\xampp\htdocs\MantissaAdmin\public\ResponsiveFilemanager\filemanager\config\config.php on line 2

Where on line 2, the code is

session_start();

How can I make it so that Zend framework 2 do not interfere with the file manager session.

Eres
  • 1,559
  • 1
  • 16
  • 25

2 Answers2

3

This is not an issue of ZF2. There is a serialized object in your session which php tries to unserialize when session_start is called. But because PHP can't find the class (which is not declared), it uses __PHP_Incomplete_Class instead.

See: PHP: unserialize - Manual

The best way to fix: Register an autoloader to load missing classes. You can dump the class name this way:

ini_set('unserialize_callback_func', '__unserialize_callback_func');
function __unserialize_callback_func($classname)
{
    var_dump($classname);
}
session_start();
BreyndotEchse
  • 2,192
  • 14
  • 20
  • Thanks a lot. It worked when I loaded the class. I'm leaving a link for anyone who want more information about how to autoload, that is a bit of an explanation of your answer. http://stackoverflow.com/questions/2325884/why-is-unserialize-callback-func-needed-when-spl-autoload-register-is-already-us – Eres Sep 27 '14 at 06:36
1

In order to work with other 3rd party libraries and share sessions across software that may not be ZF2 related; you will need to ensure that you still provide access to the ZF2 autoloader as well as module autoloading. In the shared software make certain before the session starts that you bootstrap the ZF2 autoloader and initialize the ZF2 Application.

$cwd = getcwd();
chdir('/path/to/zf2-application');
require 'init_autoloader.php';
Zend\Mvc\Application::init(require 'config/application.config.php');
chdir($cwd);
session_start();