note 20694 added to ref.session
| From: | brooke at jump dot net | Date: | Fri, 12 Apr 2002 16:22:26 +0000 |
| Subject: | note 20694 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29165@lists.php.net to get a copy of this message | ||
The following code fragment works around the fact that my PHP4.1.2 (iis/cgi) does not work as
advertised. You can use it for whatever other reason you choose.
# Include this code somewhere if you're having trouble with $_SESSION not
# seeming to work as advertised.
session_start();
function Work_around_session_bogosity() {
foreach(array_keys($GLOBALS['HTTP_SESSION_VARS']) as $k) {
if (!isset($_SESSION[$k])) session_unregister($k);
}
foreach($_SESSION as $k=>$v) {
if (!session_is_registered($k)) session_register($k);
$GLOBALS['HTTP_SESSION_VARS'][$k] = $v;
$GLOBALS[$k] = $v;
}
}
register_shutdown_function('Work_around_session_bogosity');
--
http://www.php.net/manual/en/ref.session.php
http://master.php.net/manage/user-notes.php?action=edit+20694
http://master.php.net/manage/user-notes.php?action=delete+20694
http://master.php.net/manage/user-notes.php?action=reject+20694