Edit report at http://bugs.php.net/bug.php?id=53319&edit=1

 ID:                 53319
 User updated by:    Ray dot Paseur at Gmail dot com
 Reported by:        Ray dot Paseur at Gmail dot com
 Summary:            strip_tags() may strip '<br />' incorrectly
 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:

Thanks, Felipe!


Previous Comments:
------------------------------------------------------------------------
[2010-11-16 23:21:15] fel...@php.net

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] fel...@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=305418
Log: - Fixed bug #53319 (strip_tags() may strip '&lt;br /&gt;'
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

Reply via email to