From a109fddba4e3fbb6e3a2e008c0fa20a57f26103d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 12 Feb 2019 09:54:52 +0100 Subject: Remove "defensive copy" of DatePeriod properties get_properties() constructs these as fresh objects with no relation to the internals, there is no need to clone them again. Additionally the current implementation leaks memory, because the original objects are never freed (see PR #3121). --- ext/date/php_date.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 1e136e00b6..c8479b5164 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -5278,7 +5278,6 @@ PHP_METHOD(DatePeriod, __wakeup) /* {{{ date_period_read_property */ static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) { - zval *zv; if (type != BP_VAR_IS && type != BP_VAR_R) { zend_throw_error(NULL, "Retrieval of DatePeriod properties for modification is unsupported"); return &EG(uninitialized_zval); @@ -5286,13 +5285,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi Z_OBJPROP_P(object); /* build properties hash table */ - zv = std_object_handlers.read_property(object, member, type, cache_slot, rv); - if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) { - /* defensive copy */ - ZVAL_OBJ(zv, Z_OBJ_HANDLER_P(zv, clone_obj)(zv)); - } - - return zv; + return std_object_handlers.read_property(object, member, type, cache_slot, rv); } /* }}} */ -- cgit v1.2.1