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: Open +Status: To be documented Type: Bug Package: Strings related Operating System: Linux PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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
