Add DCE support for ARRAY_KEY_EXISTS

This commit is contained in:
Nikita Popov 2019-12-05 14:51:36 +01:00
parent 1c4ad17cc1
commit 9e403d65d8
2 changed files with 9 additions and 0 deletions

View File

@ -124,6 +124,7 @@ static inline zend_bool may_have_side_effects(
case ZEND_IN_ARRAY:
case ZEND_FUNC_NUM_ARGS:
case ZEND_FUNC_GET_ARGS:
case ZEND_ARRAY_KEY_EXISTS:
/* No side effects */
return 0;
case ZEND_ROPE_END:

View File

@ -4634,6 +4634,14 @@ int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ss
default:
return 1;
}
case ZEND_ARRAY_KEY_EXISTS:
if ((t2 & MAY_BE_ANY) != MAY_BE_ARRAY) {
return 1;
}
if ((t1 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
return 1;
}
return 0;
default:
return 1;
}