PHP 4.0 Bug #9120: unexpected behavior of chop(), ltrim(), rtrim(), and trim()
| From: | artymiak at safenet dot pl | Date: | Mon, 05 Feb 2001 21:51:27 +0000 |
| Subject: | PHP 4.0 Bug #9120: unexpected behavior of chop(), ltrim(), rtrim(), and trim() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-45812@lists.php.net to get a copy of this message | ||
From: artymiak@safenet.pl
Operating system: OpenBSD 2.7
PHP version: 4.0.3pl1
PHP Bug Type: Strings related
Bug description: unexpected behavior of chop(), ltrim(), rtrim(), and trim()
chop(), trim(), ltrim(), and rtrim() do not remove \v, \r, or \n.
# chop();
echo "<p><pre> chop()";
echo "<br> ------------------<br>";
$x = " ab cd ef \v\r\n" ;
echo strlen($x) . " characters: |" . $x . "|<br>";
$y = chop($x);
echo strlen($y) . " characters: |" . $y . "|</pre></p>";
# ltrim();
echo "<p><pre> ltrim()";
echo "<br> ------------------<br>";
$x = "\v\r\n ab cd ef " ;
echo strlen($x) . " characters: |" . $x . "|<br>";
$y = ltrim($x);
echo strlen($y) . " characters: |" . $y . "|</pre></p>";
# rtrim();
echo "<p><pre> rtrim()";
echo "<br> ------------------<br>";
$x = " ab cd ef \v\r\n" ;
echo strlen($x) . " characters: |" . $x . "|<br>";
$y = rtrim($x);
echo strlen($y) . " characters: |" . $y . "|</pre></p>";
#
# trim();
echo "<p><pre> trim()";
echo "<br> ------------------<br>";
$x = " \v\r\n ab cd ef \v\r\n " ;
echo strlen($x) . " characters: |" . $x . "|<br>";
$y = trim($x);
echo " " . strlen($y) . " characters: |" . $y .
"|</pre></p>";
--
Edit Bug report at: http://bugs.php.net/?id=9120&edit=1