[eluser]Adrian Walls[/eluser]
Hi,
I have a website which integrates with PayPal Express Checkout. So when a user clicks submit to purchase something they are re-directed to the PayPal website where their payment is processed and after which they are re-directed back to my website.
This works OK in virtually all browsers except we have been getting quite a few complaints that customers are experiencing an error in certain circumstances. After adding additional logging into the website we noticed this only affected customers running IE in compatibility mode and that when they returned back to our website from PayPal all session data was completely empty. What has actually happened is that CI has started a new session, which was obviously minus the session data I added before going off to PayPal.
I am storing CI sessions in the database and the following session setting are set in my config.php file:
Code:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
I've debugged through this in all browsers including IE (not in compatibility mode) completely clearing out the session table each time and I can see that in all cases there is only ever one row in the table for the duration of the transaction from the site to PayPal and back, which is exactly what I would expect. However when running IE in compatibility mode the handle to the session is gone after coming back from PayPal because it has started a new session in the database, so we have two rows present.
I thought if I passed the session id across to PayPal in the return URL, on coming back to the site I would check if the session data I was expecting was empty and if so lookup the database with this session id so I could retrieve the info needed and populate it back into the current session. This works to some extent in that when user comes back from PayPal they are still logged in, still showing user login session details, etc... However it then appears that if I click on a subsequent link on the site the session info is gone on this subsequent page load and I can now see a third session row in the sessions table. Compatibility mode appears to spawn new sessions but I don't understand how or why.
So the problem really is how can I deal with this session switching in IE compatibility mode and is there something I am just missing. Has anyone else had a similar experience in the past?
BTW....Am using CI 2.0.1.