From: danko at very dot lv
Operating system: Linux
PHP version: 5.4Git-2012-08-31 (Git)
Package: SPL related
Bug Type: Bug
Bug description:Assigning to ArrayObject[null][something] creates phantom keys
in all arrays
Description:
------------
Basically, when you try to assign anything to ArrayObject[null]['any_key'],
it fails as it should, but since that moment anytime you access a
non-existing key in any array, you get the last created zval, or so it
seems.
Strangely enough, all warnings and notices are shown and isset() returns
false.
Test script:
---------------
<?
$a = new ArrayObject();
$b = [];
$a[null]['hurr'] = 'durr';
var_dump($a['epic_magic']);
var_dump($b['epic_magic']);
var_dump($c['epic_magic']); // Undefined var!!
$d = [];
var_dump($a['epic_magic']); // more magic!
var_dump($d['epic_magic']);
$e = 'srsly?';
var_dump($a['epic_magic']); // srsly.
Expected result:
----------------
Warning: Illegal offset type in /home/virtuall/epic.php on line 7
NULL
NULL
NULL
NULL
NULL
NULL
bool(false)
Actual result:
--------------
Warning: Illegal offset type in /home/virtuall/epic.php on line 7
array(1) {
["hurr"]=>
string(4) "durr"
}
array(1) {
["hurr"]=>
string(4) "durr"
}
array(1) {
["hurr"]=>
string(4) "durr"
}
array(0) {
}
array(0) {
}
string(6) "srsly?"
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=62987&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62987&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62987&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=62987&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62987&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=62987&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62987&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=62987&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=62987&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=62987&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=62987&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=62987&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=62987&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=62987&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62987&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=62987&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62987&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=62987&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=62987&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=62987&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=62987&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=62987&r=mysqlcfg