From: [EMAIL PROTECTED]
Operating system: Gentoo
PHP version: 5.2.6
PHP Bug Type: SPL related
Bug description: ArrayObject does not allow empty strings as keys
Description:
------------
While '' works as an array key, it does not work with ArrayObject. It
should either work both or none (first one preferred).
Reproduce code:
---------------
php > $foo = new ArrayObject();
php > $foo[''] = 'lala';
PHP Fatal error: Uncaught exception 'InvalidArgumentException' with
message 'An offset must not begin with \0 or be empty' in php shell code:1
Stack trace:
#0 php shell code(1): unknown()
#1 {main}
thrown in php shell code on line 1
InvalidArgumentException: An offset must not begin with \0 or be empty in
php shell code on line 1
Call Stack:
16.7554 63916 1. {main}() php shell code:0
Expected result:
----------------
Same as for arrays.
php > $foo = array();
php > $foo[''] = 'lala';
php > var_dump($foo);
array(1) {
[""]=>
string(4) "lala"
}
Actual result:
--------------
PHP Fatal error: Uncaught exception 'InvalidArgumentException' with
message 'An offset must not begin with \0 or be empty' in php shell code:1
Stack trace:
#0 php shell code(1): unknown()
#1 {main}
thrown in php shell code on line 1
InvalidArgumentException: An offset must not begin with \0 or be empty in
php shell code on line 1
Call Stack:
16.7554 63916 1. {main}() php shell code:0
--
Edit bug report at http://bugs.php.net/?id=45820&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45820&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45820&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45820&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45820&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45820&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45820&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45820&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45820&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45820&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45820&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45820&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45820&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45820&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45820&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45820&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45820&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45820&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45820&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45820&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45820&r=mysqlcfg