- Core:
. Fixed bug #70012 (Exception lost with nested finally block). (Laruence)
+ . Fixed bug #69996 (Changing the property of a cloned object affects the
+ original). (Dmitry, Laruence)
- Soap:
. Fixed bug #70032 (make_http_soap_request calls
--- /dev/null
+--TEST--
+Bug #69996 (Changing the property of a cloned object affects the original)
+--FILE--
+<?php
+
+function method($cache) {
+ $prepared = clone $cache;
+ var_dump($prepared->data);
+ $prepared->data = "bad";
+ return $prepared;
+}
+
+$cache = new stdClass();
+$cache->data = "good";
+
+for ($i = 0; $i < 5; ++$i) {
+ method($cache);
+}
+?>
+--EXPECT--
+string(4) "good"
+string(4) "good"
+string(4) "good"
+string(4) "good"
+string(4) "good"
}
} else {
if (EXPECTED(zobj->properties != NULL)) {
+ if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_REFCOUNT(zobj->properties)--;
+ }
+ zobj->properties = zend_array_dup(zobj->properties);
+ }
property = zend_hash_find(zobj->properties, Z_STR_P(property_name));
if (property) {
goto fast_assign;