PHP session lost after 2nd redirect but not first

83 Views Asked by At

I have a PHP project, which also has a Kohana PHP project in a subfolder on the site "/reports".

I redirect to the reports project like so:

redirectreports.php

<?php
session_start();
header('Location: /reports');
exit();

When a user clicks the href link, it opens the above in a new window. On the first click of the link, everything works fine and session data is available in the reports project.

The issue happens when I close the window of reports, and then click the reports link a 2nd time. My session data cannot be found the 2nd time I am redirected to reports.

I have tried passing the session id in the query string and then passing that to Session::instance('native', $_GET['id']);

But still get the following error:

Session_Exception [ 1 ]: Error reading session data.

1

There are 1 best solutions below

0
Adam Copley On BEST ANSWER

Thanks for the comments.

The actual issue here was that there was an object being stored in the session data by the "reports" package. Result in a __PHP_Incomplete_Class error.

That class wasn't accessible to the core project and so the shared info is stored as an array rather than an object.