Bug #52861 [NEW]: unset failes with ArrayObject and deep arrays
| From: | mep_eisen at web dot de | Date: | Thu, 16 Sep 2010 15:23:12 +0000 |
| Subject: | Bug #52861 [NEW]: unset failes with ArrayObject and deep arrays | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-154429@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows Vista 64
PHP version: 5.3.3
Package: SPL related
Bug Type: Bug
Bug description:unset failes with ArrayObject and deep arrays
Description:
------------
Using deep arrays unset itself or ArrayObject misbehaves. It silently does
nothing.
The problem lies in iteration 3 that mixes ArrayObject and classic arrays.
Test script:
---------------
echo "iteration1\n";
$arr = new ArrayObject();
$arr['foo'] = new ArrayObject();
$arr['foo']['bar'] = true;
unset($arr['foo']['bar']);
var_dump($arr);
echo "iteration2\n";
$arr = array();
$arr['foo']['bar'] = true;
unset($arr['foo']['bar']);
var_dump($arr);
echo "iteration3\n";
$arr = new ArrayObject();
$arr['foo']['bar'] = true;
unset($arr['foo']['bar']);
var_dump($arr);
Expected result:
----------------
iteration1
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
["foo"]=>
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
}
}
iteration2
array(1) {
["foo"]=>
array(0) {
}
}
iteration3
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
["foo"]=>
array(0) {
}
}
}
Actual result:
--------------
iteration1
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
["foo"]=>
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
}
}
iteration2
array(1) {
["foo"]=>
array(0) {
}
}
iteration3
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
["foo"]=>
array(1) {
["bar"]=>
bool(true)
}
}
}
--
Edit bug report at http://bugs.php.net/bug.php?id=52861&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52861&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52861&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52861&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52861&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52861&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52861&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52861&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52861&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52861&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52861&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52861&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52861&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52861&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52861&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52861&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52861&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52861&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52861&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52861&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52861&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52861&r=mysqlcfg