X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_message_object.c;h=edc18a0499d549d1a7c026afd1e25c51e36aef2c;hp=1a5980e18b92c690576032474b0d92debe397d7e;hb=9c3bc2cb7b5217a91a8defbbe7c5c20f33938d59;hpb=c8dff7011092296f9fcc12e68ad8eef18b19cdf4 diff --git a/http_message_object.c b/http_message_object.c index 1a5980e..edc18a0 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -350,7 +350,8 @@ zend_object_value _http_message_object_new_ex(zend_class_entry *ce, http_message } ALLOC_HASHTABLE(OBJ_PROP(o)); - zend_hash_init(OBJ_PROP(o), 0, NULL, ZVAL_PTR_DTOR, 0); + zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); ov.handle = putObject(http_message_object, o); ov.handlers = &http_message_object_handlers; @@ -360,8 +361,14 @@ zend_object_value _http_message_object_new_ex(zend_class_entry *ce, http_message zend_object_value _http_message_object_clone_obj(zval *this_ptr TSRMLS_DC) { - getObject(http_message_object, obj); - return http_message_object_new_ex(Z_OBJCE_P(this_ptr), http_message_dup(obj->message), NULL); + zend_object_value new_ov; + http_message_object *new_obj = NULL; + getObject(http_message_object, old_obj); + + new_ov = http_message_object_new_ex(old_obj->zo.ce, http_message_dup(old_obj->message), &new_obj); + zend_objects_clone_members(&new_obj->zo, new_ov, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); + + return new_ov; } void _http_message_object_free(zend_object *object TSRMLS_DC)