From: Dmitry Stogov Date: Fri, 30 May 2014 07:12:24 +0000 (+0400) Subject: Avoid useless duplication of immutable arrays X-Git-Tag: POST_PHPNG_MERGE~237 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=984c8f87d2ca3840c3d3551713e1eff15aedd712;p=php Avoid useless duplication of immutable arrays --- diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 37539d6ffe..0cfd8f456c 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -729,8 +729,10 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p ZVAL_COPY_VALUE(&tmp, value); value = &tmp; } else if (value_type == IS_CONST) { - ZVAL_DUP(&tmp, value); - value = &tmp; + if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) { + ZVAL_DUP(&tmp, value); + value = &tmp; + } } else if (Z_REFCOUNTED_P(value)) { Z_ADDREF_P(value); }