php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69584 strip_tags: meaning of $allowable_tags reverted
Submitted: 2015-05-06 14:21 UTC Modified: 2015-09-02 14:32 UTC
From: cmb@php.net Assigned: peehaa (profile)
Status: Closed Package: Strings related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cmb@php.net
New email:
PHP Version: OS:

 

 [2015-05-06 14:21 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-06 21:38 UTC] 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-07-26 13:37 UTC] 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-09-02 14:32 UTC] peehaa@php.net
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.
 [2015-09-02 14:32 UTC] peehaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: peehaa
 [2015-09-02 14:32 UTC] peehaa@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2015-09-02 14:53 UTC] peehaa@php.net
Sorry. I meant:

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.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 19:03:12 2021 UTC