Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  Bug #52861: unset fails with ArrayObject and deep arrays
This commit is contained in:
Stanislav Malyshev 2013-02-26 22:13:01 -08:00
commit 207d0ee08a
2 changed files with 23 additions and 1 deletions

View file

@ -402,7 +402,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
/* When in a write context, /* When in a write context,
* ZE has to be fooled into thinking this is in a reference set * ZE has to be fooled into thinking this is in a reference set
* by separating (if necessary) and returning as an is_ref=1 zval (even if refcount == 1) */ * by separating (if necessary) and returning as an is_ref=1 zval (even if refcount == 1) */
if ((type == BP_VAR_W || type == BP_VAR_RW) && !Z_ISREF_PP(ret)) { if ((type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) && !Z_ISREF_PP(ret)) {
if (Z_REFCOUNT_PP(ret) > 1) { if (Z_REFCOUNT_PP(ret) > 1) {
zval *newval; zval *newval;

View file

@ -0,0 +1,22 @@
--TEST--
Bug #52861 (unset failes with ArrayObject and deep arrays)
--FILE--
<?php
$arrayObject = new ArrayObject(array('foo' => array('bar' => array('baz' => 'boo'))));
unset($arrayObject['foo']['bar']['baz']);
print_r($arrayObject->getArrayCopy());
?>
--EXPECT--
Array
(
[foo] => Array
(
[bar] => Array
(
)
)
)