0

I am using Zend Framework 2 Session Container to store objects into session.

My problem : I get a __PHP_Incomplete_Class when i want retrieve my data.

I looked around on the internet and found it is an autoloader issue. Zend Framework use autoload_classmap.php to solve that kind of issue, but it doesn't work for me.

Any idea ?

EDIT

@TimFountain, i start the session in the Application module onBootstrap() function. I checked before if session.auto_start is to 0 ... it is.

My autoload_classmap.php is at the root of my module (according ZF2 structure) and looks like this :

<?php
// Generated by ZF2's ./bin/classmap_generator.php
return array(
    'CetmShop\Model\Mapper\ViewProduct' => __DIR__ . '/src/CetmShop/Model/Mapper/ViewProduct.php',
    ...
);

Of course, i get the autoloader config in the Module.php of my module :

public function getAutoloaderConfig()
{
    return array(
        'Zend\Loader\ClassMapAutoloader' => array(
            __DIR__ . '/autoload_classmap.php',
        ),
    );
}

And in my session container storage, i still get :

[0] => object(__PHP_Incomplete_Class)#68 (13) {
    ["__PHP_Incomplete_Class_Name"] => string(33) "CetmShop\Model\Mapper\ViewProduct"
    ...

Thx

doydoy44
  • 5,720
  • 4
  • 29
  • 45
kevin.jalais
  • 60
  • 1
  • 11
  • 1
    possible duplicate of http://stackoverflow.com/questions/2010427/php-php-incomplete-class-object-with-my-session-data – Exlord Mar 09 '14 at 14:29
  • Thx, but i've already seen that question. I tried solutions offered within ... but it doesn't work for me. I think i miss something with the ZF2 classmap autoloader, but i don't know what. – kevin.jalais Mar 09 '14 at 14:42
  • 1
    This just means the class you're storing in the session couldn't be autoloaded at the time the session data was read. We'll need more info to be able to help you - what class are you storing, how should this class be autoloaded, and where in your app are you starting the session? – Tim Fountain Mar 09 '14 at 16:18
  • I edited my question with some code – kevin.jalais Mar 09 '14 at 16:33
  • 3
    U need to start your session AFTER your auto-loading – DarkBee Mar 09 '14 at 16:46
  • I guess this is what is already happening because Zend call function getAutoloaderConfig() before onBootstrap. I placed exit points and var dumps to check it. – kevin.jalais Mar 09 '14 at 16:57
  • @KevOne - make sure. I've had a [similar problem](http://stackoverflow.com/questions/5894292/incomplete-php-class-when-serializing-object-in-sessions) with ZF1. – nevvermind Mar 11 '14 at 10:46

0 Answers0