]> granicus.if.org Git - php/commitdiff
Evaluate str_starts_with and str_ends_with on constants
authorTyson Andre <tysonandre775@hotmail.com>
Thu, 7 May 2020 13:14:15 +0000 (09:14 -0400)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Thu, 7 May 2020 14:24:03 +0000 (16:24 +0200)
When both arguments are strings,
this is guaranteed not to emit notices.

Closes GH-5539

ext/opcache/Optimizer/sccp.c

index adea2187785c638ecc629c8d4cd2e95c382ff372..187a69c79f08da4e91348f929f36e6895f16c795 100644 (file)
@@ -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) {