summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2013-02-26 22:12:15 -0800
committerStanislav Malyshev <stas@php.net>2013-02-26 22:12:36 -0800
commit7c082325091ee7bfcf0e1e8b488b1e9fa66f0739 (patch)
treeca3073e9e3b95b8fed7e8db690039e4c59205f42 /ext/spl
parent52d1add0fe385d0e0d8b1132edd11168eb7fe0e4 (diff)
parent61099f85857193c223dd62b0c5302507a77cf0ab (diff)
downloadphp-git-7c082325091ee7bfcf0e1e8b488b1e9fa66f0739.tar.gz
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3: Bug #52861: unset fails with ArrayObject and deep arrays
Diffstat (limited to 'ext/spl')
-rw-r--r--ext/spl/spl_array.c2
-rw-r--r--ext/spl/tests/bug52861.phpt22
2 files changed, 23 insertions, 1 deletions
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 40efc43915..2c2c87d027 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -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;
diff --git a/ext/spl/tests/bug52861.phpt b/ext/spl/tests/bug52861.phpt
new file mode 100644
index 0000000000..30a3261c4e
--- /dev/null
+++ b/ext/spl/tests/bug52861.phpt
@@ -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
+ (
+ )
+
+ )
+
+)
+