From: Nikita Popov Date: Mon, 30 Mar 2020 08:37:12 +0000 (+0200) Subject: SCCP: Optimize strpos with empty needle X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a34480ec824b04abf2dcb7368d10c23487a33381;p=php SCCP: Optimize strpos with empty needle This is no longer special cases in PHP 8. --- diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index 60ddd9f508..f9eef41af9 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -886,13 +886,6 @@ static inline int ct_eval_func_call( return FAILURE; } /* pass */ - } else if (zend_string_equals_literal(name, "strpos")) { - if (Z_TYPE_P(args[0]) != IS_STRING - || Z_TYPE_P(args[1]) != IS_STRING - || !Z_STRLEN_P(args[1])) { - return FAILURE; - } - /* pass */ } else if (zend_string_equals_literal(name, "str_split")) { if (Z_TYPE_P(args[0]) != IS_STRING || Z_TYPE_P(args[1]) != IS_LONG @@ -960,7 +953,8 @@ static inline int ct_eval_func_call( } ZEND_HASH_FOREACH_END(); } /* pass */ - } else if (zend_string_equals_literal(name, "version_compare")) { + } else if (zend_string_equals_literal(name, "strpos") + || zend_string_equals_literal(name, "version_compare")) { if (Z_TYPE_P(args[0]) != IS_STRING || Z_TYPE_P(args[1]) != IS_STRING) { return FAILURE;