PHP 4.0 Bug #4854: trim doesn't remove the null character in a string
| From: | jennings at tazcomputer dot com | Date: | Wed, 07 Jun 2000 01:17:56 +0000 |
| Subject: | PHP 4.0 Bug #4854: trim doesn't remove the null character in a string | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-20409@lists.php.net to get a copy of this message | ||
From: jennings@tazcomputer.com
Operating system: linux
PHP version: 4.0.0 Release
PHP Bug Type: Misbehaving function
Bug description: trim doesn't remove the null character in a string
I have been storing encyrpted strings in a mysql database. When I retrieve the string and
decyrpted, it appears to add null characters to multiples of 8. I then passed the string through
the trim function to remove them but it doesn't trim them. I wrote the following to correct
the problem for me.
function mytrim($str) {
$str = str_replace("\0","",$str);
return $str;
}
TIA,
James