Bug #63212 [NEW]: <' breaks strip_tags()
From: dac dot chartrand at gmail dot com
Operating system:
PHP version: 5.4.7
Package: *General Issues
Bug Type: Bug
Bug description: <' breaks strip_tags()
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 bug report at https://bugs.php.net/bug.php?id=63212&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63212&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63212&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63212&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63212&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63212&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63212&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63212&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63212&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63212&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63212&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63212&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63212&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63212&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63212&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63212&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63212&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63212&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63212&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63212&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63212&r=mysqlcfg
Thread (7 messages)
- dac dot chartrand at gmail dot com