]> granicus.if.org Git - php/commitdiff
Micro-optimization
authorDmitry Stogov <dmitry@zend.com>
Tue, 9 Apr 2019 11:38:49 +0000 (14:38 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 9 Apr 2019 11:38:49 +0000 (14:38 +0300)
Zend/zend_execute.h

index b82592200862b6af40769f6608bfa79bba230e93..deb299abd1169fd2ccb6b4685d6208976184a240 100644 (file)
@@ -96,20 +96,19 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
                                if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) {
                                        zend_bool need_copy = ZEND_CONST_COND(value_type & (IS_CONST|IS_CV), 1) ||
                                                ((value_type & IS_VAR) && UNEXPECTED(ref) && GC_REFCOUNT(ref) > 1);
+                                       zend_bool ret;
                                        if (need_copy) {
                                                ZVAL_COPY(&tmp, value);
                                                value = &tmp;
                                        }
-                                       if (!zend_verify_ref_assignable_zval(Z_REF_P(variable_ptr), value, strict)) {
-                                               if (need_copy) {
-                                                       Z_TRY_DELREF_P(value);
-                                               }
-                                               zval_ptr_dtor(value);
-                                               return Z_REFVAL_P(variable_ptr);
-                                       }
+                                       ret = zend_verify_ref_assignable_zval(Z_REF_P(variable_ptr), value, strict);
                                        if (need_copy) {
                                                Z_TRY_DELREF_P(value);
                                        }
+                                       if (!ret) {
+                                               zval_ptr_dtor(value);
+                                               return Z_REFVAL_P(variable_ptr);
+                                       }
                                }
 
                                variable_ptr = Z_REFVAL_P(variable_ptr);