#46578 [NEW]: strip tags does not honor end-of-comment when it encounters a single quote
| From: | j at ww dot com | Date: | Sat, 15 Nov 2008 11:40:57 +0000 |
| Subject: | #46578 [NEW]: strip tags does not honor end-of-comment when it encounters a single quote | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-130984@lists.php.net to get a copy of this message | ||
From: j at ww dot com
Operating system: linux/debian
PHP version: 5.2CVS-2008-11-15 (CVS)
PHP Bug Type: Filter related
Bug description: strip tags does not honor end-of-comment when it encounters a single quote
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 bug report at http://bugs.php.net/?id=46578&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46578&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46578&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46578&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46578&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46578&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46578&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46578&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46578&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46578&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46578&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46578&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46578&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46578&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46578&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46578&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46578&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46578&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46578&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46578&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46578&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46578&r=mysqlcfg