Migrating legacy code - changing session name
| From: | Rory McKinley | Date: | Tue, 26 Jan 2010 08:25:23 +0000 |
| Subject: | Migrating legacy code - changing session name | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-301463@lists.php.net to get a copy of this message | ||
Hello List
A client has asked me to migrate a few scripts that have been running
merrily under PHP4 to PHP5.2. Part of these scripts have integration
with PHPMyAdmin
using the single sign-on and so they make use of the following code :
session_write_close();
session_name("blah");
session_start();
Now, assuming that prior to session_write_close(), I have a session
that (amongst other elements) contains the following:
$_SESSION['a'] = (an instance of Object A)
$_SESSION['b'] = (an instance of Object B)
$_SESSION['c'] = (an instance of Object C)
After session_start(), I have the following :
$_SESSION['a'] = (an instance of Object C)
$_SESSION['b'] = (an instance of Object C)
$_SESSION['c'] = (an instance of Object C)
This does not consistently happen, only under particular circumstances
(it seems to be a certain set of elements in $_SESSION triggers it).
For instance, if I unset $_SESSION['b'] * prior* to doing
session_write_close() - the behaviour stops, and the elements are
retained. Has anybody seen this before?
Vital Stats:
PHP5.2
Apache1.3
FastCGI
Sessions are stored using PHP5's default session handling.
Thanks in advance