Skip to content

Commit 9f8f84a

Browse files
TysonAndrekocsismate
authored andcommitted
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
1 parent 4a51262 commit 9f8f84a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ext/opcache/Optimizer/sccp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,8 @@ static inline int ct_eval_func_call(
955955
/* pass */
956956
} else if (zend_string_equals_literal(name, "strpos")
957957
|| zend_string_equals_literal(name, "str_contains")
958+
|| zend_string_equals_literal(name, "str_starts_with")
959+
|| zend_string_equals_literal(name, "str_ends_with")
958960
|| zend_string_equals_literal(name, "version_compare")) {
959961
if (Z_TYPE_P(args[0]) != IS_STRING
960962
|| Z_TYPE_P(args[1]) != IS_STRING) {

0 commit comments

Comments
 (0)