mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
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:
commit
207d0ee08a
2 changed files with 23 additions and 1 deletions
|
@ -402,7 +402,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
|
|||
/* When in a write context,
|
||||
* 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) */
|
||||
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) {
|
||||
zval *newval;
|
||||
|
||||
|
|
22
ext/spl/tests/bug52861.phpt
Normal file
22
ext/spl/tests/bug52861.phpt
Normal 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
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue