#46578 [Ver->Csd]: strip_tags() does not honor end-of-comment when it encounters a single quote
| From: | felipe@php.net | Date: | Fri, 21 Nov 2008 19:18:35 +0000 |
| Subject: | #46578 [Ver->Csd]: strip_tags() does not honor end-of-comment when it encounters a single quote | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-131191@lists.php.net to get a copy of this message | ||
ID: 46578
Updated by: felipe@php.net
Reported By: j at ww dot com
-Status: Verified
+Status: Closed
Bug Type: Strings related
Operating System: *
PHP Version: 5CVS, 6CVS (2008-11-21)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-11-15 11:40:57] j at ww dot com
Description:
------------
There is a nasty little gotcha in 'strip_tags', if you have a single
quote inside an html comment strip_tags will ignore the end-of-comment
tag!
So, <!-- test --> this works, but <!-- test I've --> this does not, the
end-of-comment tag will be ignored.
Reproduce code:
---------------
$i = "<!-- testing I've been to mars --> quite so";
echo(strip_tags($i));
Expected result:
----------------
It should read "quite so", instead it returns a blank string,
presumably because no end quote was encountered (the parser has probably
switched into 'attribute' mode, but in a comment there are no
attributes). Adding another quote to the above example will verify this
hypothesis.
Actual result:
--------------
an empty string.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46578&edit=1