ID: 44072
User updated by: sergey89 at gmail dot com
-Summary: substr don't work correctly with binary stings
Reported By: sergey89 at gmail dot com
Status: Open
Bug Type: Strings related
Operating System: FreeBSD 6.3
PHP Version: 5.2.5
New Comment:
-
Previous Comments:
------------------------------------------------------------------------
[2008-02-07 18:31:06] sergey89 at gmail dot com
Description:
------------
substr don't work correctly with binary strings on FreeBSD 6.3, PHP
5.2.5. I have some binary file. When i tried to cut part of data i get
incorrect result.
-----
mbstring.function_overload 0
Reproduce code:
---------------
<?php
$data = file_get_contents('data');
print md5($data) . ' | ';
print md5(substr($data, 0, -88));
?>
Expected result:
----------------
45e26dc33aad8e93f3f45c8d5100feb0 | 03d900cc2ba7276fb3bb3f1939303e3b
Actual result:
--------------
45e26dc33aad8e93f3f45c8d5100feb0 | d1cea9d93cb48b2d897595f5e96ba352
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44072&edit=1