strip_tags() may strip '<br />' incorrectly
| Bug #53319 | strip_tags() may strip '<br />' incorrectly | ||||
|---|---|---|---|---|---|
| Submitted: | 2010-11-16 01:22 UTC | Modified: | 2011-02-10 17:09 UTC | ||
| From: | Ray dot Paseur at Gmail dot com | Assigned: | vrana (profile) | ||
| Status: | Closed | Package: | Strings related | ||
| PHP Version: | 5.3.3 | OS: | Linux | ||
| Private report: | No | CVE-ID: | None | ||
[2010-11-16 01:22 UTC] Ray dot Paseur at Gmail dot com
Description: ------------ --- From manual page: http://www.php.net/function.strip-tags#Return Values --- Test script: --------------- <?php // RAY_strip_tags_anomaly.php error_reporting(E_ALL); // SELF-CLOSING TAGS WITH SPACES $str = '<td>USD<br /><br />CDN</td>'; $new = strip_tags($str); echo $new; // Prints USDCDN // TRY TO PRESERVE ALLOWABLE TAGS $new = strip_tags($str, '<br />'); echo $new; // Prints USDCDN -- The break tag is not preserved $new = strip_tags($str, '<br>'); echo $new; // Prints USD<br /><br />CDN // SELF-CLOSING TAGS WITHOUT SPACES $str = '<td>USD<br/><br/>CDN</td>'; $new = strip_tags($str, '<br/>'); echo $new; // Prints USD<br/><br/>CDN Expected result: ---------------- strip_tags() should preserve the allowable_tags Actual result: -------------- strip_tags did not always preserve the allowable_tags
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2010-11-16 23:21 UTC] felipe@php.net
-Status: Open +Status: To be documented
[2010-11-16 23:21 UTC] felipe@php.net
[2010-11-16 23:22 UTC] felipe@php.net
-Summary: Strip_tags() may strip '<br />' incorrectly +Summary: strip_tags() may strip '<br />' incorrectly
[2010-11-17 03:01 UTC] Ray dot Paseur at Gmail dot com
[2011-02-10 17:09 UTC] vrana@php.net
-Status: To be documented +Status: Closed -Assigned To: +Assigned To: vrana
[2011-02-10 17:09 UTC] vrana@php.net