Bug #12120 Updated: Several following < characters ignored by striptags()

From: Date: Sun, 19 Aug 2001 17:31:23 +0000
Subject: Bug #12120 Updated: Several following < characters ignored by striptags()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-63747@lists.php.net to get a copy of this message
ID: 12120 User updated by: michel@eevolved.com Reported By: michel@eevolved.com Old Status: Feedback Status: Open Bug Type: Strings related Operating System: Linux Mandrake PHP Version: 4.0.4pl1 New Comment: I did not try with the newest release, and unfortunatly cannot currently test more with any version (different computer, not suitable for PHP.) Sorry I could not help. Do note, though, that I have been to many, many sites who use PHP, to look into what their solution is to striptags(), and all the sites seem to use a custom function. Obviously, I am not the only one to have this problem (again, as far as 4.0.4pl1 is concerned.) Previous Comments: ------------------------------------------------------------------------ [2001-08-19 05:00:02] sniper@php.net Does this happen with PHP 4.0.6? ------------------------------------------------------------------------ [2001-07-12 21:54:40] michel@eevolved.com $foo = strip_tags("< < <b>hello</b>", "<b>"); echo $foo; // prints "< b>hello" with a hidden "</b>" strip_tags(), in this case, returns the string it was supplied, but omits the second and third '<' character. In a regular browser, it would display the 3 '<' characters, seperated by spaces: "< < <" (equivalent to "&lt; &lt; &lt;") followed by a bold hello. Yet since PHP probably raises a flag after the first "<", all subsequent "<" characters are ignored until the next ">". To resume: Source witSource without strip_tags: "< < <b>hello</b>" Source with strip_tags: "< b>hello</b>" I would also like to point out: $foo = strip_tags("< < < >hello</b>", "<b>"); echo $foo; Source without strip_tags: "< < < >hello</b>" Source with strip_tags: "hello</b>" ------------------------------------------------------------------------ [2001-07-12 20:32:58] michel@eevolved.com $foo = strip_tags("< < <b>hello</b>", "<b>"); echo $foo; // prints "< b>hello" with a hidden "</b>" strip_tags(), in this case, returns the string it was supplied, but omits the second and third '<' character. In a regular browser, it would display the 3 '<' characters, seperated by spaces: "< < <" (equivalent to "&lt; &lt; &lt;") followed by a bold hello. Yet since PHP probably raises a flag after the first "<", all subsequent "<" characters are ignored until the next ">". To resume: Source witSource without strip_tags: "< < <b>hello</b>" Source with strip_tags: "< b>hello</b>" hout strip_tags: "< < <b>hello</b>" Source with strip_tags: "< b>hello</b>" I would also like to point out: $foo = strip_tags("< < < >hello</b>", "<b>"); echo $foo; Source without strip_tags: "< < < >hello</b>" Source with strip_tags: "hello</b>" ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=12120&edit=1

« previous php.dev (#63747) next »