#26721 [Opn->Csd]: strrpos() on strings containing null
| From: | iliaa@php.net | Date: | Fri, 26 Dec 2003 20:07:48 +0000 |
| Subject: | #26721 [Opn->Csd]: strrpos() on strings containing null | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52508@lists.php.net to get a copy of this message | ||
ID: 26721
Updated by: iliaa@php.net
Reported By: norxh at binnews dot com
-Status: Open
+Status: Closed
Bug Type: Strings related
Operating System: RedHat 9
PHP Version: 4.3.4
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, 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/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
In PHP 4.3.X strrpos() is not binary safe, this is fixed in
PHP 5.0
Previous Comments:
------------------------------------------------------------------------
[2003-12-26 07:43:54] norxh at binnews dot com
Description:
------------
strrpos() does not return the proper values when the string contains a
null character.
strpos() works properly.
Reproduce code:
---------------
$test = "Hello";
var_dump(strpos($test, 'e'));
var_dump(strrpos($test, 'e'));
$test = "\x00Hello";
var_dump(strpos($test, 'e'));
var_dump(strrpos($test, 'e'));
$test = "Hello\x00";
var_dump(strpos($test, 'e'));
var_dump(strrpos($test, 'e'));
Expected result:
----------------
int(1)
int(1)
int(2)
int(2)
int(1)
int(1)
Actual result:
--------------
int(1)
int(1)
int(2)
bool(false)
int(1)
int(2)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26721&edit=1