mirror of
https://github.com/php/php-src.git
synced 2026-04-26 01:18:19 +02:00
fix #35402 (New date class causes crash in get_object_vars())
This commit is contained in:
+12
-1
@@ -1152,11 +1152,16 @@ static zend_object_value date_object_new_date(zend_class_entry *class_type TSRML
|
||||
{
|
||||
php_date_obj *intern;
|
||||
zend_object_value retval;
|
||||
zval *tmp;
|
||||
|
||||
intern = emalloc(sizeof(php_date_obj));
|
||||
memset(intern, 0, sizeof(php_date_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_date, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_date;
|
||||
|
||||
@@ -1189,6 +1194,12 @@ static void date_object_free_storage_date(void *object TSRMLS_DC)
|
||||
timelib_time_dtor(intern->time);
|
||||
}
|
||||
|
||||
if (intern->std.properties) {
|
||||
zend_hash_destroy(intern->std.properties);
|
||||
efree(intern->std.properties);
|
||||
intern->std.properties = NULL;
|
||||
}
|
||||
|
||||
efree(object);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user