Home » HTTP » HTTP_Session » Bug #8660
Sessions are stored, but can't retrieve
Details
| Submitted | 2006-09-07 23:28 UTC |
|---|---|
| From | tonylambiris at gmail dot com |
| Assigned | troehr |
| Status | Bogus |
| Package | HTTP_Session |
| PHP Version | 4.3.9 |
| OS | CentOS 4.4 |
| Roadmaps | (Not assigned) |
Comments
[2006-09-07 23:28 UTC] tonylambiris at gmail dot com
Description:
------------
I can set session ID's, verified by looking in the database, but I can't seem to retrieve them out.
Here is my code to create a session:
HTTP_Session::setContainer("DB", array("dsn" => $dsn, "table" => "sessions"))
HTTP_Session::start("sid");
HTTP_Session::set("user", $rows);
header("Location: index.php?nav=home");
Test script:
---------------
Here is the code to retrieve:
echo("Session name: <b>'" . HTTP_Session::name() . "'</b><br>\n");
echo("Session id: <b>'" . HTTP_Session::id() . "'</b><br>\n");
echo("Is new session: <b>'" . (HTTP_Session::isNew() ? "<span style='color: red;'>yes</span>" : "no") . "'</b><br>\n");
echo("Is expired: <b>'" . (HTTP_Session::isExpired() ? "<span style='color: red;'>yes</span>" : "no") . "'</b><br>\n");
echo("Is idle: <b>'" . (HTTP_Session::isIdle() ? "<span style='color: red;'>yes</span>" : "no") . "'</b><br>\n");
echo("Variable: <b>'" . HTTP_Session::get("user") . "'</b><br>\n");
Expected result:
----------------
Session name: 'sid'
Session id: '792f9eafc315c3df0fdef2d658e73566'
Is new session: 'yes'
Is expired: 'no'
Is idle: 'no'
Variable: '__HTTP_Session_Info|i:2;user|a:1:{i:0;a:6:{s:2:"id";s:1:"1";s:5:"login";s:4:"demo";s:8:"password";s:16:"testing";s:10:"first_name";s:4:"Demo";s:9:"last_name";s:4:"User";s:3:"zip";s:5:"00000";}}'
Actual result:
--------------
Session name: 'PHPSESSID'
Session id: ''
Is new session: 'yes'
Is expired: 'no'
Is idle: 'no'
Variable: ''
[2006-09-08 18:28 UTC] tonylambiris at gmail dot com
This from the output:
0
refresh
[2006-09-08 18:31 UTC] tonylambiris at gmail dot com
Hitting refresh made the number sequence go like this:
0, 1, 0, 1, 2, 3, 4, 5....