Skip to content

Commit 7a91516

Browse files
wkhudgins92Will Hudgins
authored andcommitted
Updated mb_str_iends
1 parent 857ca2a commit 7a91516

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
@@ -2774,9 +2774,16 @@ PHP_FUNCTION(mb_str_iends)
27742774
RETURN_BOOL(1);
27752775
}
27762776

2777-
n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, 0, enc_name);
2777+
mbfl_string haystack_tail;
2778+
haystack_tail.encoding = haystack.encoding;
2779+
haystack_tail.no_language = haystack.no_language;
2780+
unsigned char* haystack_tail_val = haystack.val + sizeof(char) * (haystack.len - needle.len);
2781+
haystack_tail.val = haystack_tail_val;
2782+
haystack_tail.len = needle.len;
2783+
2784+
n = php_mb_stripos(0, (char *)haystack_tail.val, haystack_tail.len, (char *)needle.val, needle.len, 0, enc_name);
27782785
if (!mbfl_is_error(n)) {
2779-
if (n == (haystack.len - needle.len)) {
2786+
if (n == 0) {
27802787
RETURN_BOOL(1);
27812788
} else {
27822789
RETURN_BOOL(0);

0 commit comments

Comments
 (0)