RE: [PHP] strip_tags bug ?

From: Date: Fri, 07 Jun 2002 23:02:12 +0000
Subject: RE: [PHP] strip_tags bug ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101215@lists.php.net to get a copy of this message
I realize the importance of using valid html stuff. Here, however, I'm trying to validate *user input*, not fix up my own HTML pages. And I have no way of teaching the users to say &lt; and &gt; instead of < and > when they fill out their forms. On Sat, 8 Jun 2002, David Freeman wrote: > > > The minor problem is that it treats a "not-equals" sign, > > "<>", as an empty tag and strips it, unless it's explicitely > > ...etc... > > Except, of course, that when writing html you are supposed to use > entities for any valid html stuff - ie. Use &gt; and $lt; for > < and so > on. As you should also use &quot; if you want a " in your html. The > fact that various browsers will let you get away with this does not make > it valid html. > > The argument above it a little like saying that there's a bug in php > because it will get confused if you have " marks inside your " marks... > Eg. > > $string = "fred said "wow" to me"; > I think my point still stands -- strip_tags() is intended to validate what users enter into forms. Of course, I wouldn't think of letting them write my PHP code :))

« previous php.general (#101215) next »