From: Tyson Andre Date: Thu, 7 May 2020 13:14:15 +0000 (-0400) Subject: Evaluate str_starts_with and str_ends_with on constants X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f8f84adbca9d29cf573e7b8216e60e0251bd5af;p=php Evaluate str_starts_with and str_ends_with on constants When both arguments are strings, this is guaranteed not to emit notices. Closes GH-5539 --- diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index adea218778..187a69c79f 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) {