diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-12 09:54:52 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-12 09:54:52 +0100 |
commit | a109fddba4e3fbb6e3a2e008c0fa20a57f26103d (patch) | |
tree | 5f335a2521c081dbce7d1c44aff759564459dcf0 | |
parent | c4294440ffc4a59a1298292b76072e6759034a68 (diff) | |
download | php-git-a109fddba4e3fbb6e3a2e008c0fa20a57f26103d.tar.gz |
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).
-rw-r--r-- | ext/date/php_date.c | 9 |
1 files changed, 1 insertions, 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); } /* }}} */ |