note 53586 added to ref.session
| From: | ) | Date: | Mon, 06 Jun 2005 19:55:39 +0000 |
| Subject: | note 53586 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90022@lists.php.net to get a copy of this message | ||
Hi,
I have been using PHP sessions for a looooong time and can't believe i have not ran into this.
It seems you cannot use numeric keys at the root level of the $_SESSION array. This maybe a security
thing of some sorts for the session set/get functions. Who knows.
But yes, note the following...
<?php
$applications_id = 5000;
//This does not get set and does not throw an error
$_SESSION[$applications_id]['customer_id'] = 123;
//This works fine
$_SESSION['applications'][$applications_id]['customer_id'] = 123;
?>
I am guessing the allowed array keys for the root level are something like the reg exp
'/[a-z].*/'. It would be cool if php threw at least a notice if something else was used.
Blaine Garrett
Webmaster of the art attack
http://artattack.to
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53586
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53586&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53586&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53586&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53586&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53586&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53586&report=yes
Search -- http://master.php.net/manage/user-notes.php