You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mb_strrpos() returns the wrong position for a negative offset in a non-UTF-8 encoding #22779
For a single-byte encoding one byte is one character, so mb_strrpos() should agree with strrpos() here. The result is wrong for a negative offset in any non-UTF-8 encoding. An ISO-8859-1 needle byte in 0x80-0xBF gives a position that is too early, and an ASCII needle in UTF-16 also returns the wrong position.
PHP Version
PHP 8.4.25-dev (the same code is in 8.3, 8.5 and master)
Activity
youkidearitai commentedon Jul 17, 2026
Thanks for report. I confirmed behavior changes from PHP 8.3
https://3v4l.org/MpZOD#veol
@alexdowad What do you think?
alexdowad commentedon Jul 17, 2026
@youkidearitai I commented in @eyupcanakman's PR.
Fix GH-22779: mb_strrpos() wrong result in a non-UTF-8 encoding
bug #693 [Mbstring] Fix search functions that ignore the needle, offs…