Req #66299 [NEW]: General sugestion on the correct use function strip_tags
| From: | m dot klemarczyk at live dot com | Date: | Mon, 16 Dec 2013 01:19:45 +0000 |
| Subject: | Req #66299 [NEW]: General sugestion on the correct use function strip_tags | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183345@lists.php.net to get a copy of this message | ||
From: m dot klemarczyk at live dot com
Operating system:
PHP version: 5.5.7
Package: Strings related
Bug Type: Feature/Change Request
Bug description:General sugestion on the correct use function strip_tags
Description:
------------
---
From manual page: http://www.php.net/function.strip-tags
---
I'm not opposed to the current way of using this function.
I think that should also behave similarly to how JS interprets tags.
This functionality can be for many people a very useful, for one simple
reason, passed all structures specified tag.
Test script:
---------------
<?php // striptags.php
$data = '<br>Each<br/>New<br />Line';
$new = strip_tags($data, '<br>');
var_dump($new);
$data = '<br>Each<br/>New<br />Line';
$new = strip_tags($data, '<br/>');
var_dump($new);
$data = '<br>Each<br/>New<br />Line';
$new = strip_tags($data, '<br />');
var_dump($new);
$data = '<br>Each<br/>New<br />Line';
$new = strip_tags($data, array('br'));
var_dump($new);
$data = '<br>Each<br/>New<br />Line';
$new = strip_tags($data, array('BR'));
var_dump($new);
?>
Expected result:
----------------
// OUTPUTS string(21) "<br>EachNew<br />Line"
// OUTPUTS string(16) "Each<br/>NewLine"
// OUTPUTS string(11) "EachNewLine"
// OUTPUTS string(21) "<br>Each<br/>New<br />Line"
// OUTPUTS string(21) "<br>Each<br/>New<br />Line"
Actual result:
--------------
// OUTPUTS string(21) "<br>EachNew<br />Line"
// OUTPUTS string(16) "Each<br/>NewLine"
// OUTPUTS string(11) "EachNewLine"
// OUTPUTS string(11) "EachNewLine"
// OUTPUTS string(11) "EachNewLine"
--
Edit bug report at https://bugs.php.net/bug.php?id=66299&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66299&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66299&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66299&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66299&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66299&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66299&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66299&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66299&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66299&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66299&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66299&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66299&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66299&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66299&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66299&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66299&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66299&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66299&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66299&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66299&r=mysqlcfg