]> granicus.if.org Git - php/commitdiff
Do constant evaluation for str_contains in opcache
authorTyson Andre <tysonandre775@hotmail.com>
Sun, 29 Mar 2020 21:42:11 +0000 (17:42 -0400)
committerTyson Andre <tysonandre775@hotmail.com>
Mon, 30 Mar 2020 13:54:38 +0000 (09:54 -0400)
Both arguments must be strings.
str_contains deliberately does not emit a warning for an empty needle.

Closes GH-5324

ext/opcache/Optimizer/sccp.c

index f9eef41af91e3d8e85ab9dd737cdb32437dd9fb4..d5c27ca664c45edab09f10f29fd5577e81abc04b 100644 (file)
@@ -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) {