php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42085 mb_strrpos() inconsistent with strrpos() with negative offset
Submitted: 2007-07-24 10:53 UTC Modified: 2007-08-19 01:59 UTC
From: arjen at react dot nl Assigned: hirokawa (profile)
Status: Closed Package: mbstring related
PHP Version: 5.2.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: arjen at react dot nl
New email:
PHP Version: OS:

 

 [2007-07-24 10:53 UTC] arjen at react dot nl
Description:
------------
From the manual: 
Note: As of PHP 5.2.0 offset may be specified to begin searching an arbitrary number of characters into the string. Negative values will stop searching at an arbitrary point prior to the end of the string. 

Negative offsets are not working.

Reproduce code:
---------------
var_dump(mb_strrpos('abcd', 'd', -2));
var_dump(mb_strrpos('abcdd', 'd', -2));

Expected result:
----------------
boolean false
int 3

Actual result:
--------------
int 3
int 4

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-17 13:48 UTC] jani@php.net
Assigned to the maintainer of mbstring extension.
 [2007-08-19 01:59 UTC] hirokawa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 06:01:30 2024 UTC