views:

644

answers:

2

I'm running a Zend Framework powered website and it seems to have serious problems with sessions. I have a 5 step process where I save the form data in the session between the steps and then save it into the database on the last step.

When we built the site sometimes the session just went away and forced us to restart. Now it seems to work again but recently we discovered an issue with Internet Explorer 8. It fails between step 2 -> 3 and forgets the session. It works fine in IE6, IE7, FF, Chrome, Safari and even in my mobile web browser (SE P1).

We're storing our sessions in the database and if I deactivate the session db handler it works. What's the difference between using the database and not using it for sessions? Do I loose something if I switch back?

Bootstrap:

/* Start session */
$saveHandler = new Zend_Session_SaveHandler_DbTable(array(
    'name'           => 'sessions', 
    'primary'        => 'id', 
    'modifiedColumn' => 'modified',
    'dataColumn'     => 'data',
    'lifetimeColumn' => 'lifetime' 
));
Zend_Session::rememberMe((int) $config->session->lifetime);
$saveHandler->setLifetime((int) $config->session->lifetime) 
    ->setOverrideLifetime(true);
Zend_Session::setSaveHandler($saveHandler);
Zend_Session::start();

and in my step controller

$session = new Zend_Session_Namespace('wizard');

Then I'm just working with $session saving data in a stdClass in $session.

A: 

How is your session being stored? Is this happening in Zend_Form multistep, or your own?

My guess is that your data between steps is growing too large to be stored in your session storage strategy.

Justin
I'm storing it by myself using a stdClass. Whats too large, how much can you store in a session?
Emil
My session contains around 1 kb of data.
Emil
A: 

Add this header to fix this issue:

header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
talha bulut
Can you explain what the header does?
Emil