ID: 27394
Updated by: [EMAIL PROTECTED]
Reported By: rob_raux at redkeysolutions dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Linux 2.4.18-14
PHP Version: 4.3.4
New Comment:
RTFM:
"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."
Previous Comments:
------------------------------------------------------------------------
[2004-02-25 10:04:36] rob_raux at redkeysolutions dot com
Description:
------------
My apologies if this is a dup, I've searched and searched and found
nothing.
php.ini [relevant]:
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
As commented in the code, the $_SESSION variable is not correctly set
when both $array[1] and $array['string'] are set.
Reproduce code:
---------------
<?php
session_start();
//this is our goal, to get here.
if(isset($_SESSION['allSet'])){
print_r($_SESSION);
session_destroy();
}
//start the test.
else{
/* this numeric key creates the problem.
commented out "$basic_array[0] = 4;" and this code will work fine,
otherwise we have an infinite redirect. */
$basic_array[1] = 4;
$basic_array['user_id'] = 4;
$basic_array['email'] = "[EMAIL PROTECTED]";
foreach(array_keys($basic_array) AS $key){
$_SESSION[$key] = $basic_array[$key];
}
$_SESSION['allSet'] = 1;
header("Location: http://FULLPATHTOSERVER/LOGINTEST.php");
}
Expected result:
----------------
The $_SESSION variable should contain all the relevant data.
Actual result:
--------------
$_SESSION contains no data, despite being set.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27394&edit=1