Doc #69584 [Com]: strip_tags: meaning of $allowable_tags reverted
| From: | peehaa@php.net | Date: | Wed, 02 Sep 2015 14:32:32 +0000 |
| Subject: | Doc #69584 [Com]: strip_tags: meaning of $allowable_tags reverted | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12701@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69584&edit=1
ID: 69584
Comment by: peehaa@php.net
Reported by: cmb@php.net
Summary: strip_tags: meaning of $allowable_tags reverted
Status: Open
Type: Documentation Problem
Package: Strings related
Operating System: *
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
You are right Chris.
Self-closing tags in the allowable_tags param are simply ignored and non-self-closing tags also
preserve self-closing tags as it should.
Previous Comments:
------------------------------------------------------------------------
[2015-09-02 00:34:45] cmb@php.net
Related To: Bug #70402
------------------------------------------------------------------------
[2015-07-26 13:37:39] chris at ocportal dot com
I found this too. As far as I can tell this note, and the note in the changelog, are 100% nonsense.
The parameter is for allowable, not preserved.
But also, it doesn't seem to have any truth whatsoever to it.
echo strip_tags('<br><br />','<br>');
produces "<br><br />".
echo strip_tags('<br><br />','');
produces "".
i.e. self-closing is not a consideration at any point.
------------------------------------------------------------------------
[2015-05-15 15:05:51] cmb@php.net
Related To: Bug #69641
------------------------------------------------------------------------
[2015-05-06 21:38:22] cmb@php.net
I've noticed that the respective changelog entry is also in error.
FWIW: the behavioral change can be seen on
<http://3v4l.org/W5aEu>.
------------------------------------------------------------------------
[2015-05-06 14:21:15] cmb@php.net
Description:
------------
---
From manual page: http://www.php.net/function.strip-tags
---
The third note about the $allowable_tags parameter reverts its
meaning:
| In PHP 5.3.4 and later, you will also need to include the
| self-closing XHTML tag to strip these from str. For example, to
| strip both <br> and <br/>, you should use:
Instead of "strip", "preserved" or so should be used.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69584&edit=1