From ea04ea7376a9d24e9ee93ef62d70ece20087a0c1 Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Thu, 7 May 2020 09:14:15 -0400 Subject: [PATCH] Evaluate str_starts_with and str_ends_with on constants When both arguments are strings, this is guaranteed not to emit notices. --- ext/opcache/Optimizer/sccp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index adea2187785c6..187a69c79f08d 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -955,6 +955,8 @@ 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, "str_starts_with") + || zend_string_equals_literal(name, "str_ends_with") || zend_string_equals_literal(name, "version_compare")) { if (Z_TYPE_P(args[0]) != IS_STRING || Z_TYPE_P(args[1]) != IS_STRING) {