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 @@ -2718,9 +2718,18 @@ PHP_FUNCTION(mb_str_ends)
2718
2718
RETURN_BOOL (0 );
2719
2719
}
2720
2720
2721
- n = mbfl_strpos (& haystack , & needle , haystack .len - needle .len , 0 );
2722
- if (!mbfl_is_error (n )) {
2721
+ mbfl_string haystack_tail ;
2722
+ haystack_tail .encoding = haystack .encoding ;
2723
+ haystack_tail .no_language = haystack .no_language ;
2724
+ unsigned char * haystack_tail_val = haystack .val + sizeof (char ) * (haystack .len - needle .len );
2725
+ haystack_tail .val = haystack_tail_val ;
2726
+ haystack_tail .len = needle .len ;
2727
+
2728
+ n = mbfl_strpos (& haystack_tail , & needle , 0 , 0 );
2729
+ if (!mbfl_is_error (n ) && n == 0 ) {
2723
2730
RETURN_BOOL (1 );
2731
+ } else if (!mbfl_is_error (n )) {
2732
+ RETURN_BOOL (0 );
2724
2733
} else {
2725
2734
switch (- n ) {
2726
2735
case 1 :
You can’t perform that action at this time.
0 commit comments