#40274 [Com]: Sessions fail with numeric root keys
| From: | jhansen at unitedmcgill dot com | Date: | Fri, 02 Feb 2007 18:57:14 +0000 |
| Subject: | #40274 [Com]: Sessions fail with numeric root keys | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108347@lists.php.net to get a copy of this message | ||
ID: 40274
Comment by: jhansen at unitedmcgill dot com
Reported By: ben at vanilla dot net
Status: Assigned
Bug Type: Session related
Operating System: FreeBSD 6.2
PHP Version: 5.2.0
Assigned To: iliaa
New Comment:
I had a similar issue on a gentoo box (I could not make changes to
session variables), and came across this blog post:
http://bloggingabout.net/blogs/ramon/archive/2006/10/27/Weird-php-session-behaviour.aspx
Sure enough, turning off register globals fixed the problem for me.
iliaa: Could this be related?
Previous Comments:
------------------------------------------------------------------------
[2007-01-29 13:48:23] ben at vanilla dot net
Juts noticed this is the same with numeric strings and
ordinary numeric keys.
------------------------------------------------------------------------
[2007-01-29 13:40:28] ben at vanilla dot net
Description:
------------
If you set a session variable with the root key as a numeric
string it fails to save. It also fails to save anything else
in the array after the numeric rook key string.
This was via FCGI with lighttpd, but also reproduced on Debian
etch with apache2.
Reproduce code:
---------------
Set a session :-
<?php
session_start();
$_SESSION['Test1'] = "This should be ok";
$_SESSION['123']['test']="This is a test";
$_SESSION['Test2'] = "This is not saved";
?>
<PRE>
Session Set:
<?php print_r($_SESSION); ?>
</PRE>
Read it :-
<?php
session_start();
?>
<PRE>
Session Read:
<?php print_r($_SESSION); ?>
</PRE>
Expected result:
----------------
I would expect to see the same details in the session from the
second piece of code as output from the first. :-
Session Read:
Array
(
[Test1] => This should be ok
[123] => Array
(
[test] => This is a test
)
[Test2] => This is not saved
)
Actual result:
--------------
Session Read:
Array
(
[Test1] => This should be ok
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40274&edit=1