Re: PHP 4.0 Bug #4815 Updated: trim does not trim \v and \0
| From: | Patrick Meisel | Date: | Wed, 07 Jun 2000 00:13:26 +0000 |
| Subject: | Re: PHP 4.0 Bug #4815 Updated: trim does not trim \v and \0 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-20444@lists.php.net to get a copy of this message | ||
Hi thanks for your fast answer, but:
in that case it is either me, who put this bug in the wrong category
(maybe rather a documentation problem) or you haven't read the docs
(http://bugs.php.net/manual/function.trim.php)
It says: The whitespace characters it currently strips are: "\n", "\r",
"\t", "\v", "\0", and a plain space.
Any way there has to be a function that strips the NULL from a string,
because if you do an addslashes() on a string NULL becomes \0!!
I have a function, that takes a substring of length 30, bu in some cases
this contain NULL, so I do a trim, which doesn´t do anything. At some
other point I have to do an addslaches to this string to insert it into
a
database. And then all the NULLs are \0. If I do another trim nothing is
done to the string again.
As I think, that this i what trim() was made for, maybe you should
reopen
the Bug-Report.
I am trying to keep my mails as short as possible, so if you need more
info (example code) just ask for it.
Thanks in advance,
Patrick Meisel
> ID: 4815
> Updated by: hholzgra
> Reported By: patrick@karlshof.de
> Status: Closed
> Bug Type: Misbehaving function
> Assigned To:
> Comments:
>
> this ain't C, '\v' has no special meaning here
> (if you think it should, add a feature request)
> so its two distinct characters in $test
>
> try this
> $test="test".chr(11);
> instead of
> $test="test"."\v";
> and it'll work
>
> and for '\0' i don't think that it qualifies
> as whitespace
>
> Full Bug description available at:
> http://bugs.php.net/version4/?id=4815