#26278 [Opn->Bgs]: Can not user integer variable in $_SESSION
| From: | sniper@php.net | Date: | Mon, 17 Nov 2003 19:38:44 +0000 |
| Subject: | #26278 [Opn->Bgs]: Can not user integer variable in $_SESSION | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-50499@lists.php.net to get a copy of this message | ||
ID: 26278
Updated by: sniper@php.net
Reported By: glumtail at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: FreeBSD
PHP Version: 4.3.2
New Comment:
Of course you can't.
RTFM (http://www.php.net/session):
"The keys in the $_SESSION associative array are subject to the same
limitations as regular variable names in PHP, i.e. they cannot start
with a number and must start with a letter or underscore. For more
details see the section on variables in this manual."
Previous Comments:
------------------------------------------------------------------------
[2003-11-16 20:01:32] glumtail at yahoo dot com
Description:
------------
I found it can not save integer variable in session.
e.g:
$_SESSION['TEST'] = 'SOMETHING' // OK
$_SESSION[1] = 'SOMETHING' // ERROR
My environment: FreeBSD + PHP 4.3.2
I think it must be a BIG bug.
Reproduce code:
---------------
<?php
session_start();
print_r($_SESSION); // always can not print $_SESSION[1]
$_SESSION[1] = 'TEST';
$_SESSION['TEST'] = 'MY TEST';
print_r($_SESSION);
?>
Expected result:
----------------
Result (after refresh):
Array ( )
Array ( [1] => TEST [TEST] => MY TEST )
The correct result should be:
Array ( [1] => TEST [TEST] => MY TEST )
Array ( [1] => TEST [TEST] => MY TEST )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26278&edit=1