diff options
author | Dmitry Stogov <dmitry@zend.com> | 2020-10-22 23:15:39 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2020-10-22 23:15:39 +0300 |
commit | 838d8d0ba0aea856a395e605c990bd44d4fb325e (patch) | |
tree | 44e30b22902c0cefa4eea852580e6b3fca165477 | |
parent | 5626dcdb9dd041b0f0d97928035abab5c14a630e (diff) | |
download | php-git-838d8d0ba0aea856a395e605c990bd44d4fb325e.tar.gz |
Fixed reference-counter inference
-rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index be9add10cf..1bcce64a28 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -3392,18 +3392,20 @@ static zend_always_inline int _zend_update_type_info( if (opline->result_type != IS_TMP_VAR) { tmp |= MAY_BE_REF | MAY_BE_INDIRECT; } else if (!(opline->op1_type & (IS_VAR|IS_TMP_VAR)) || !(t1 & MAY_BE_RC1)) { + zend_class_entry *ce = NULL; + + if (opline->op1_type == IS_UNUSED) { + ce = op_array->scope; + } else if (ssa_op->op1_use >= 0 && !ssa->var_info[ssa_op->op1_use].is_instanceof) { + ce = ssa->var_info[ssa_op->op1_use].ce; + } if (prop_info) { /* FETCH_OBJ_R/IS for plain property increments reference counter, so it can't be 1 */ - tmp &= ~MAY_BE_RC1; - } else { - zend_class_entry *ce = NULL; - - if (opline->op1_type == IS_UNUSED) { - ce = op_array->scope; - } else if (ssa_op->op1_use >= 0 && !ssa->var_info[ssa_op->op1_use].is_instanceof) { - ce = ssa->var_info[ssa_op->op1_use].ce; + if (ce && !ce->create_object) { + tmp &= ~MAY_BE_RC1; } + } else { if (ce && !ce->create_object && !ce->__get) { tmp &= ~MAY_BE_RC1; } |