Edit report at http://bugs.php.net/bug.php?id=53319&edit=1
ID: 53319 Updated by: [email protected] Reported by: Ray dot Paseur at Gmail dot com Summary: strip_tags() may strip '<br />' incorrectly -Status: To be documented +Status: Closed Type: Bug Package: Strings related Operating System: Linux PHP Version: 5.3.3 -Assigned To: +Assigned To: vrana Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2011-02-10 17:09:24] [email protected] This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. ------------------------------------------------------------------------ [2010-11-17 03:01:13] Ray dot Paseur at Gmail dot com Thanks, Felipe! ------------------------------------------------------------------------ [2010-11-16 23:21:15] [email protected] I've fixed the bug related to '<br>' is stripping <br/> in the string. About strip_tags($str, '<br/>'): The allowed tags should not contains slash char. This must be documented though. ------------------------------------------------------------------------ [2010-11-16 23:16:46] [email protected] Automatic comment from SVN on behalf of felipe Revision: http://svn.php.net/viewvc/?view=revision&revision=305418 Log: - Fixed bug #53319 (strip_tags() may strip '<br />' incorrectly) ------------------------------------------------------------------------ [2010-11-16 01:22:26] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53319&edit=1
