- Bugfix #36941 (ArrayIterator does not clone itself)

This commit is contained in:
Marcus Boerger 2006-04-01 22:39:42 +00:00
parent 1160f87d1d
commit ac099ca676
2 changed files with 25 additions and 0 deletions

View File

@ -228,6 +228,7 @@ static zend_object_value spl_array_object_clone(zval *zobject TSRMLS_DC)
spl_array_object *intern;
old_object = zend_objects_get_address(zobject TSRMLS_CC);
SEPARATE_ZVAL(&zobject);
new_obj_val = spl_array_object_new_ex(old_object->ce, &intern, zobject TSRMLS_CC);
new_object = &intern->std;

24
ext/spl/tests/bug36941.phpt Executable file
View File

@ -0,0 +1,24 @@
--TEST--
Bug #36941 (ArrayIterator does not clone itself)
--FILE--
<?php
$a = new ArrayIterator();
$a[] = 1;
$b = clone $a;
var_dump($a[0], $b[0]);
$b[0] = $b[0] + 1;
var_dump($a[0], $b[0]);
$b[0] = 3;
var_dump($a[0], $b[0]);
?>
===DONE===
--EXPECT--
int(1)
int(1)
int(1)
int(2)
int(1)
int(3)
===DONE===