From cdc05eba619f7ee5dd0bafd1b6853022872bf760 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 28 Sep 2021 14:04:16 +0200 Subject: [PATCH] Remove outdated code in ASSIGN_DIM type inference All of these cases throw an exception now rather than returning null. --- ext/opcache/Optimizer/zend_inference.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index e005c8852cd..d5ade4e0ff0 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2751,31 +2751,17 @@ static zend_always_inline int _zend_update_type_info( if (t1 & MAY_BE_STRING) { tmp |= MAY_BE_STRING; } - if (t1 & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_STRING)) { + if (t1 & (MAY_BE_ARRAY|MAY_BE_FALSE|MAY_BE_NULL|MAY_BE_UNDEF)) { tmp |= (OP1_DATA_INFO() & (MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF)); if (OP1_DATA_INFO() & MAY_BE_UNDEF) { tmp |= MAY_BE_NULL; } - if (opline->op2_type == IS_UNUSED) { - /* When appending to an array and the LONG_MAX key is already used - * null will be returned. */ - tmp |= MAY_BE_NULL; - } - if (t2 & (MAY_BE_ARRAY | MAY_BE_OBJECT)) { - /* Arrays and objects cannot be used as keys. */ - tmp |= MAY_BE_NULL; - } - if (t1 & (MAY_BE_ANY - (MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY))) { - /* undef, null and false are implicitly converted to array, anything else - * results in a null return value. */ - tmp |= MAY_BE_NULL; - } } - tmp |= MAY_BE_RC1 | MAY_BE_RCN; if (t1 & MAY_BE_OBJECT) { tmp |= MAY_BE_REF; } + tmp |= MAY_BE_RC1 | MAY_BE_RCN; UPDATE_SSA_TYPE(tmp, ssa_op->result_def); } if ((ssa_op+1)->op1_def >= 0) {