ID:               45820
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Assigned
 Bug Type:         SPL related
 Operating System: Gentoo
 PHP Version:      5.2.6
-Assigned To:      
+Assigned To:      colder


Previous Comments:
------------------------------------------------------------------------

[2008-08-14 12:45:46] [EMAIL PROTECTED]

In 5.3 it behaves differently:

$ php -r '$a = new ArrayObject(); $a[''] = "foo"; var_dump($a);'
object(ArrayObject)#1 (1) {
  ["storage":"ArrayObject":private]=>
  array(1) {
    [0]=>
    string(3) "foo"
  }
}


------------------------------------------------------------------------

[2008-08-14 12:13:57] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=45820&edit=1

Reply via email to