#44721 [NEW]: Calling session_register() can create inaccessible array entries
| From: | antphill at uk dot ibm dot com | Date: | Mon, 14 Apr 2008 16:09:00 +0000 |
| Subject: | #44721 [NEW]: Calling session_register() can create inaccessible array entries | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-124218@lists.php.net to get a copy of this message | ||
From: antphill at uk dot ibm dot com
Operating system: Windows XP and Linux
PHP version: 5.2.6RC5
PHP Bug Type: Session related
Bug description: Calling session_register() can create inaccessible array entries
Description:
------------
If I call session_register with a string key that is in fact an integer,
then it creates an entry in $_SESSION that is inaccessible using array
indexes by a script. I think this is because the extension is adding the
key to the array directly rather than using the hash APIs that convert
string keys to integers where possible.
Reproduce code:
---------------
<?php
session_start();
session_register("123");
var_dump($_SESSION);
var_dump($_SESSION["123"]);
var_dump($_SESSION[123]);
?>
Actual result:
--------------
array(1) {
["123"]=>
NULL
}
Notice: Undefined index: 123 in D:\ant.php on line 5
NULL
Notice: Undefined offset: 123 in D:\ant.php on line 6
NULL
--
Edit bug report at http://bugs.php.net/?id=44721&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44721&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44721&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44721&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44721&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44721&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44721&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44721&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44721&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44721&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44721&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44721&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44721&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44721&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44721&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44721&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44721&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44721&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44721&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44721&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44721&r=mysqlcfg