#35584 [Opn->Bgs]: ltrim() chops the first letter "C"
| From: | tony2001@php.net | Date: | Wed, 07 Dec 2005 14:51:11 +0000 |
| Subject: | #35584 [Opn->Bgs]: ltrim() chops the first letter "C" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-89897@lists.php.net to get a copy of this message | ||
ID: 35584
Updated by: tony2001@php.net
Reported By: motion_4u at hotmail dot com
-Status: Open
+Status: Bogus
-Bug Type: Scripting Engine problem
+Bug Type: Strings related
Operating System: Win2k Server
PHP Version: 5.1.1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
See http://php.net/strrchr and http://php.net/ltrim
Previous Comments:
------------------------------------------------------------------------
[2005-12-07 15:38:01] motion_4u at hotmail dot com
Description:
------------
Function ltrim() chops one character extra incase the string starts
with "c"!
funny but true
You better check the rtrim() function too since I have found bugs there
too.
You can test this function directly online there:
http://motions.sytes.net/funny_ltrim.php
Reproduce code:
---------------
$url="C:\\dir1\\dir2\\filename.txt";
echo "<br>";
$url = ltrim(strrchr($url,'\x5c'),'\x5c');
echo $url;
// ok output: filename.txt
$url="C:\\dir1\\dir2\\cfilename.txt";
echo "<br>";
$url = ltrim(strrchr($url,'\x5c'),'\x5c');
echo $url;
// output: again filename.txt but should be cfilename.txt
// WHERE IS THE "C" CHARACTER?
Expected result:
----------------
filename.txt
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35584&edit=1