Re: [PHP4BETA] Small patch to string.c
| From: | Peter Kovacs | Date: | Sat, 18 Mar 2000 22:34:00 +0000 |
| Subject: | Re: [PHP4BETA] Small patch to string.c | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12382@lists.php.net to get a copy of this message | ||
On Sun, 19 Mar 2000 rasmus@php.net wrote:
> > While this isn't extensively tested, this patch modifies strip_tags to
> > convert > characters encountered in state 0 (the output state) into the
> > string ">". Whether or not this is entirely useful is another story.
>
> Hrm.. This doesn't seem like a good idea to me. If you want to convert <
> to < feed the output of strip_tags() through htmlspecialchars()
I don't want to convert < to < (otherwise I would just use
htmlspecialchars like you suggest), I want to convert the > character to
> under certain circumstances (i.e. when it isn't part of a tag) Right
now strip_tags removes these characters from its output.
> strip_tags() takes an optional argument of allowable tags. Your patch
> would render this arg useless.
I just tested this and it seems to work fine: I passed the following input
through strip_tags using "<a><b>" as the "Allowable tags" argument.
<a href="http://www.knowpost.com/">KnowPost</a>
<b>This is bold</b>
> this has a carat in front of it.
<i>this isn't italics</i>
And it exhibits the correct behavior.
I'm not saying this is necessarily desirable behavior, I added it because
I need "lone" > characters to appear.
Peter
--------------------------------------------------
Peter D. Kovacs KnowPost.com LLC
Lead Engineer peter@knowpost.com
--------------------------------------------------