Bug #63212 [Opn->Nab]: <' breaks strip_tags()
Edit report at https://bugs.php.net/bug.php?id=63212&edit=1
ID: 63212
Updated by: pierrick@php.net
Reported by: dac dot chartrand at gmail dot com
Summary: <' breaks strip_tags()
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
PHP Version: 5.4.7
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Hi Daniel,
I don't think this is a bug. You're opening a tag which is not terminated. So
strip_tags will strip it.
If you replace your <' by any other char (but space) like <a you'll have the
same behavior.
Previous Comments:
------------------------------------------------------------------------
[2012-10-03 22:08:54] dac dot chartrand at gmail dot com
Description:
------------
The following character combo <' breaks strip_tags():
<'
Test script:
---------------
<?php
$content = "<strong>Hello World</strong><fake>Should be
removed</fake><h1>Goodbye World</h1>";
$content = strip_tags($content,
'<del><ins><p><div><span><hr><br><cite><strong><em><pre><img><a><h1><h2><h3><h4><h5><h6><dl><dt><dd><ul><li><ol><sub><sup><tt><blockquote><aside><table><thead><tbody><tfoot><tr><td><th>');
echo $content;
// Good
// <strong>Hello World</strong>Should be removed<h1>Goodbye World</h1>
$content = "<strong>Hello World</strong><fake>Should <' be
removed</fake><h1>Goodbye World</h1>";
$content = strip_tags($content,
'<del><ins><p><div><span><hr><br><cite><strong><em><pre><img><a><h1><h2><h3><h4><h5><h6><dl><dt><dd><ul><li><ol><sub><sup><tt><blockquote><aside><table><thead><tbody><tfoot><tr><td><th>');
echo $content;
// Bad
// <strong>Hello World</strong>Should
Expected result:
----------------
<strong>Hello World</strong>Should be removed<h1>Goodbye World</h1>
Actual result:
--------------
<strong>Hello World</strong>Should
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63212&edit=1
Thread (7 messages)