#35584 [NEW]: ltrim() chops the first letter "C"
| From: | motion_4u at hotmail dot com | Date: | Wed, 07 Dec 2005 14:38:02 +0000 |
| Subject: | #35584 [NEW]: ltrim() chops the first letter "C" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-89896@lists.php.net to get a copy of this message | ||
From: motion_4u at hotmail dot com
Operating system: Win2k Server
PHP version: 5.1.1
PHP Bug Type: Scripting Engine problem
Bug description: ltrim() chops the first letter "C"
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 bug report at http://bugs.php.net/?id=35584&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35584&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35584&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35584&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35584&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35584&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35584&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35584&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35584&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35584&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35584&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35584&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35584&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35584&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35584&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35584&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35584&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35584&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35584&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35584&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35584&r=mysqlcfg