#41854 [Opn->Bgs]: Bug when php try to serialize a array with a number for key
| From: | iliaa@php.net | Date: | Mon, 02 Jul 2007 15:57:03 +0000 |
| Subject: | #41854 [Opn->Bgs]: Bug when php try to serialize a array with a number for key | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-114539@lists.php.net to get a copy of this message | ||
ID: 41854
Updated by: iliaa@php.net
Reported By: leonardo dot celis at ohstudio dot com dot ar
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Windows XP
PHP Version: 5.2.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The $_SESSION super-global cannot contain keys that are entirely
numeric
because it causes problems for register globals when every key becomes
a
variable and PHP does not allow entirely numeric variable names.
Previous Comments:
------------------------------------------------------------------------
[2007-06-29 17:36:42] leonardo dot celis at ohstudio dot com dot ar
Description:
------------
start.php: here the value is serialize, but php take the value from
memory and show it.
show.php: here the value is take from the session file and try to
unserialize. The session file have 0 bytes. Therefor the value is no
show.
However this script works:
<?
$var['1'] = "Hola mundo";
$x = unserialize(serialize($var));
echo serialize($var) . "<br>";
print_r($x);
?>
This bug I've founded with my partner Mario García.
Reproduce code:
---------------
start.php
<?
session_start();
$_SESSION['1'] = "Hola mundo";
print_r($_SESSION);
?>
show.php
<?
session_start();
print_r($_SESSION);
?>
Expected result:
----------------
Array ( [1] => Hola mundo )
Actual result:
--------------
Array ( )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41854&edit=1