From: Tyson Andre Date: Sun, 29 Mar 2020 21:42:11 +0000 (-0400) Subject: Do constant evaluation for str_contains in opcache X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47ddd95836142a5bea28abab26999e72d5f85493;p=php Do constant evaluation for str_contains in opcache Both arguments must be strings. str_contains deliberately does not emit a warning for an empty needle. Closes GH-5324 --- diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index f9eef41af9..d5c27ca664 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -954,6 +954,7 @@ static inline int ct_eval_func_call( } /* pass */ } else if (zend_string_equals_literal(name, "strpos") + || zend_string_equals_literal(name, "str_contains") || zend_string_equals_literal(name, "version_compare")) { if (Z_TYPE_P(args[0]) != IS_STRING || Z_TYPE_P(args[1]) != IS_STRING) {