Edit report at http://bugs.php.net/bug.php?id=52754&edit=1
ID: 52754
User updated by: dotpointer at gmail dot com
Reported by: dotpointer at gmail dot com
Summary: Array keys in $_SESSION with "!" unsets the whole
array in PHP 5.3.3
Status: Bogus
Type: Bug
Package: Session related
Operating System: Slackware Linux 12
PHP Version: 5.3.3
Block user comment: N
New Comment:
That's fine for me. I did not know that, so I used the site name as key,
which worked fine until I updated PHP, then suddenly this happened.
Previous Comments:
------------------------------------------------------------------------
[2010-09-01 06:25:51] [email protected]
I'm not too sure how or why this would have worked in 5.2, but session
variables not being able to use certain characters in their names is
documented behaviour, per http://php.net/session.examples.basic ââ:
"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."
------------------------------------------------------------------------
[2010-08-31 21:47:10] dotpointer at gmail dot com
Description:
------------
Array keys in $_SESSION containing exclamation marks (!) does not seem
to work anymore as of 5.3.3.
Have tried key with different characters like #, " and £ - these
worked. Using "!" in the key seems not only to be unregistered but also
to make the whole $_SESSION to be unset in the next run.
This worked before, as in 5.2.x.
Test script:
---------------
<?
# (as we're talking sessions, this example need to be run 2 times to
set the session data, push F5...)
session_start();
$name = 'hello'; # this does work, uncomment/comment to test
$name = 'hello!'; # this does not, uncomment/comment to test
echo $_SESSION[$name];
$_SESSION[$name] = 'OK';
?>
Expected result:
----------------
That array keys containing exclamation marks ("!") either give a
understandable error or does work as any other key.
Actual result:
--------------
The whole array is being totally empty if a key containing exclamation
mark is entered.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52754&edit=1