}
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;
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)
{
http_message_object *o = (http_message_object *) object;
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
if (o->message) {
http_message_dtor(o->message);
efree(o->message);
p.value.obj = o->parent;
zend_objects_store_del_ref(&p TSRMLS_CC);
}
- efree(o);
+ freeObject(o);
}
static zval *_http_message_object_read_prop(zval *object, zval *member, int type TSRMLS_DC)