File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -2710,9 +2710,18 @@ PHP_FUNCTION(mb_str_ends)
2710
2710
RETURN_BOOL (0 );
2711
2711
}
2712
2712
2713
- n = mbfl_strpos (& haystack , & needle , haystack .len - needle .len , 0 );
2714
- if (!mbfl_is_error (n )) {
2713
+ mbfl_string haystack_tail ;
2714
+ haystack_tail .encoding = haystack .encoding ;
2715
+ haystack_tail .no_language = haystack .no_language ;
2716
+ unsigned char * haystack_tail_val = haystack .val + sizeof (char ) * (haystack .len - needle .len );
2717
+ haystack_tail .val = haystack_tail_val ;
2718
+ haystack_tail .len = needle .len ;
2719
+
2720
+ n = mbfl_strpos (& haystack_tail , & needle , 0 , 0 );
2721
+ if (!mbfl_is_error (n ) && n == 0 ) {
2715
2722
RETURN_BOOL (1 );
2723
+ } else if (!mbfl_is_error (n )) {
2724
+ RETURN_BOOL (0 );
2716
2725
} else {
2717
2726
switch (- n ) {
2718
2727
case 1 :
You can’t perform that action at this time.
0 commit comments