From: Antony Dovgal Date: Sat, 26 Nov 2005 12:37:20 +0000 (+0000) Subject: MF51: add properties hashtable to Timezone class X-Git-Tag: RELEASE_2_0_2~75 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34c4afe3ddd9b263a59a130d0fdd0dc649ed5501;p=php MF51: add properties hashtable to Timezone class --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 1718c77686..78300cbb21 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1172,11 +1172,16 @@ static zend_object_value date_object_new_timezone(zend_class_entry *class_type T { php_timezone_obj *intern; zend_object_value retval; + zval *tmp; intern = emalloc(sizeof(php_timezone_obj)); memset(intern, 0, sizeof(php_timezone_obj)); intern->std.ce = class_type; + ALLOC_HASHTABLE(intern->std.properties); + zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC); retval.handlers = &date_object_handlers_timezone; @@ -1205,6 +1210,14 @@ static void date_object_free_storage_date(void *object TSRMLS_DC) static void date_object_free_storage_timezone(void *object TSRMLS_DC) { + php_timezone_obj *intern = (php_timezone_obj *)object; + + if (intern->std.properties) { + zend_hash_destroy(intern->std.properties); + efree(intern->std.properties); + intern->std.properties = NULL; + } + efree(object); }