#35584 [Bgs]: ltrim() chops the first letter C

2005-12-07 Thread motion_4u at hotmail dot com
 ID:   35584
 User updated by:  motion_4u at hotmail dot com
 Reported By:  motion_4u at hotmail dot com
 Status:   Bogus
 Bug Type: Strings related
 Operating System: Win2k Server
 PHP Version:  5.1.1
 New Comment:

I agree, the problem is not the PHP, though those they program it.
There is no logical explanation for that the function ltream() should
respond like that and if so, it is useless and should be removed.
The documentations about this function do not refer to this problem
too.
What interesting about this problem is that the Borland Dos Compiler
version 4.0 had the same problem.


Previous Comments:


[2005-12-07 15:51:10] [EMAIL PROTECTED]

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



[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=35584edit=1


#35584 [Bgs]: ltrim() chops the first letter C

2005-12-07 Thread tony2001
 ID:   35584
 Updated by:   [EMAIL PROTECTED]
 Reported By:  motion_4u at hotmail dot com
 Status:   Bogus
 Bug Type: Strings related
 Operating System: Win2k Server
 PHP Version:  5.1.1
 New Comment:

Read the docs AGAIN and see that you're explicitly trimming symbols
'\', 'x', '5' and 'c'.
No bug or something unexpected here, move along.


Previous Comments:


[2005-12-07 21:05:02] motion_4u at hotmail dot com

I agree, the problem is not the PHP, though those they program it.
There is no logical explanation for that the function ltream() should
respond like that and if so, it is useless and should be removed.
The documentations about this function do not refer to this problem
too.
What interesting about this problem is that the Borland Dos Compiler
version 4.0 had the same problem.



[2005-12-07 15:51:10] [EMAIL PROTECTED]

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



[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=35584edit=1