#29198 [Opn->Bgs]: strip_tags silently strips out <!...> tags

From: Date: Tue, 28 Dec 2004 03:37:27 +0000
Subject: #29198 [Opn->Bgs]: strip_tags silently strips out <!...> tags
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-71147@lists.php.net to get a copy of this message
ID: 29198 User updated by: steven at acko dot net Reported By: steven at acko dot net -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Windows 2000 PHP Version: 5.0.0 New Comment: I checked the English documentation and indeed, it is documented there. It is missing from the Dutch translation of that page, which php.net defaults to, hence I didn't notice it. Previous Comments: ------------------------------------------------------------------------ [2004-12-28 00:44:11] support at jevon dot org Isn't this already documented? http://nz2.php.net/strip_tags ------------------------------------------------------------------------ [2004-07-16 06:01:02] steven at acko dot net Description: ------------ The strip_tags function is hardcoded to strip out <!...> tags, such as comments. It is IMO expected behaviour for the function that specifying "<!-->" or "<!DOCTYPE>" in the allowed tags list leaves these intact. If this is expected behaviour for this function, then the documentation should be updated. (PS: The state machine in php_strip_tags() in string.c seems to contain some redundancies. Someone who understand all of it should take a closer look ;)) Reproduce code: --------------- <?php print strip_tags("Some text. <!-- a comment --> Some text.", "<!-->"); ?> Expected result: ---------------- The output should be: Some text. <!-- a comment --> Some text. (with the comment intact) Actual result: -------------- The output is: Some text. Some text. (the comment is stripped out) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29198&edit=1

« previous php.bugs (#71147) next »