File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -32,4 +32,9 @@ object(Clazz)#%d (2) {
32
32
["b"]=>
33
33
string(7) "__clone"
34
34
}
35
- Error: Cannot modify readonly property Clazz::$b
35
+ object(Clazz)#%d (2) {
36
+ ["a"]=>
37
+ string(7) "default"
38
+ ["b"]=>
39
+ string(4) "with"
40
+ }
Original file line number Diff line number Diff line change @@ -294,6 +294,14 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members_ex(zend_object *new_objec
294
294
}
295
295
296
296
if (EXPECTED (!EG (exception )) && properties != NULL ) {
297
+ /* Unlock readonly properties once more. */
298
+ if (ZEND_CLASS_HAS_READONLY_PROPS (new_object -> ce ) && old_object -> ce -> clone ) {
299
+ for (uint32_t i = 0 ; i < new_object -> ce -> default_properties_count ; i ++ ) {
300
+ zval * prop = OBJ_PROP_NUM (new_object , i );
301
+ Z_PROP_FLAG_P (prop ) |= IS_PROP_REINITABLE ;
302
+ }
303
+ }
304
+
297
305
zend_class_entry * old_scope = EG (fake_scope );
298
306
299
307
EG (fake_scope ) = scope ;
You can’t perform that action at this time.
0 commit comments