Bug #17099 Updated: strip_tags() not just stripping out HTML-tags

From: Date: Wed, 08 May 2002 15:52:25 +0000
Subject: Bug #17099 Updated: strip_tags() not just stripping out HTML-tags
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-7254@lists.php.net to get a copy of this message
ID: 17099 Updated by: jimw@php.net Reported By: yves@fuifbeest.com -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Unix/Apache PHP Version: 4.2.0 New Comment: this is intentional. strip_tags requires the caller to declare what tags to keep, regardless of whether they are valid html or not. if you just want to get rid of angle brackets, you can use str_replace() or use htmlentities() to preserve them, but prevent them from being interpreted as html tag delimiters. Previous Comments: ------------------------------------------------------------------------ [2002-05-08 10:50:10] yves@fuifbeest.com I've made a PHP-based forum and some of the users found out that if they were putting text between < or > (HTML &lt; and &gt; ), this text was lost... Browsing through the source-code and a little tests later, I found out it was strip_tags() causing the problem... strip_tags() is described as "stripping out all HTML- and PHP-tags", so I thought this was a nice way to prevent users from making some sort of childish color-book with images, color-text, etc. in between of the serious posts... Now it appears that strip_tags() strips out ANYTHING in an string between < and > (the hTML fishing-hooks, sorry for mentioning all the time, but I don't if you're seeing them), so that's rather inconvenient I thought... Wouldn't it be possible that PHP has an internal list of all HTML-tags (maybe it has already) and that it should just stripout what a web-browser would interpret as a HTML-tag? Ex.: <?php echo strip_tags("blabla < yieha > blabla"); ?> This will return "blabla blabla"... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17099&edit=1

« previous php.bugs (#7254) next »