Skip to content

Commit 0dbe537

Browse files
authored
Updated mb_str_iends
1 parent 9a4c339 commit 0dbe537

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ext/mbstring/mbstring.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,9 +2766,16 @@ PHP_FUNCTION(mb_str_iends)
27662766
RETURN_BOOL(1);
27672767
}
27682768

2769-
n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, 0, enc_name);
2769+
mbfl_string haystack_tail;
2770+
haystack_tail.encoding = haystack.encoding;
2771+
haystack_tail.no_language = haystack.no_language;
2772+
unsigned char* haystack_tail_val = haystack.val + sizeof(char) * (haystack.len - needle.len);
2773+
haystack_tail.val = haystack_tail_val;
2774+
haystack_tail.len = needle.len;
2775+
2776+
n = php_mb_stripos(0, (char *)haystack_tail.val, haystack_tail.len, (char *)needle.val, needle.len, 0, enc_name);
27702777
if (!mbfl_is_error(n)) {
2771-
if (n == (haystack.len - needle.len)) {
2778+
if (n == 0) {
27722779
RETURN_BOOL(1);
27732780
} else {
27742781
RETURN_BOOL(0);

0 commit comments

Comments
 (0)