#43431 [Opn->Fbk]: Using /H in haystack causes truncated results
| From: | jani@php.net | Date: | Wed, 28 Nov 2007 13:47:35 +0000 |
| Subject: | #43431 [Opn->Fbk]: Using /H in haystack causes truncated results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120179@lists.php.net to get a copy of this message | ||
ID: 43431
Updated by: jani@php.net
Reported By: lowell at ietech dot com
-Status: Open
+Status: Feedback
Bug Type: Strings related
Operating System: Linux data 2.6.18.2-34
PHP Version: 5.2.5
New Comment:
Are you sure you're using the right function now?
string ltrim ( string $str [, string $charlist])
What you think is 'needle' is actually list of characters to remove.
It's not str_replace()..
Previous Comments:
------------------------------------------------------------------------
[2007-11-27 18:51:41] lowell at ietech dot com
Description:
------------
Using '/H' (uppercase 'H' is relevant) near the end of the haystack
truncates the result (In example below, first 5 letters of 'Health').
Have tried many strings to determine consistency, but have failed.
Using '/home' instead of '/Home' in string produced a different result,
but any other attempts at increasing or decreasing the # '/H's in the
string failed to reveal a consistent behavior.
Reproduce code:
---------------
$sHayStack = "/data/virtual/abc.com/Home/test/absolute/Health";
$sNeedle = "/data/virtual/abc.com/Home/test/absolute";
echo ltrim( $sHayStack, $sNeedle );
Expected result:
----------------
Health
Actual result:
--------------
h
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43431&edit=1