Same thing happens: <? $t = "Everyone knows that 2 < 3, but some people still think that 2 > 3";
$nt = strip_tags($t,'< >'); // i've also tried '<>', '<', // and all permutations thereof print $nt; ?> %> Everyone knows that 2 3 On Fri, 7 Jun 2002, Philip Hallstrom wrote: > I haven't looked at the code, but doesn't strip_tags strip everything b/n > < and >? In which case it's doing what it should below... > > The only solution I see would be to change the code to look for every > possible HTML tag that exists and only do those, but with all the > nonstandard tags I don't think that would work... > > what happens if you put "< >" in the second argument? > > On Fri, 7 Jun 2002, Mikhail Avrekh wrote: > > > Hello, > > > > There seem to be a couple of bugs in the strip_tags() function, one minor > > (or at least I know how to circumvent it) and one more serious. > > > > The minor problem is that it treats a "not-equals" sign, "<>", as an empty > > tag and strips it, unless it's explicitely set as an allowed tag > > (as in strip_tags($text,'<>') ). This is a bit awkward IMHO, but it works. > > > > The other problem is that it fails on the "less than" sign in the text. > > The function seems to consider it as an incomplete tag and removes it, as > > well as *all text after it to the next ">" sign*. So the following > > happens: > > > > <? > > $t = "Everyone knows that 2 < 3, > > but some people still think that 2 > 3"; > > > > $nt = strip_tags($t); > > print $nt; > > ?> > > > > This results in: > > > > %> Everyone knows that 2 3 > > > > > > I've looked in the archives, the notes to the function docs (one of which > > appears to relate to the latter problem), as well as the source code for > > the function itself, but it's not obvious how the second problem can be > > circumvented or fixed. I wonder if someone might have a good, tested regex > > that acts similarly to strip_tags (strips all but the allowed tags), or if I > > can get some pointers on how to fix the source code. > > > > Thanks ! > > > > M. > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php