|  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: Assigned: peehaa (profile)
Status: Closed Package: Strings related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
New email:
PHP Version: OS:


 [2015-05-06 14:21 UTC]
From manual page:

The third note about the $allowable_tags parameter reverts its

| 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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-06 21:38 UTC]
I've noticed that the respective changelog entry is also in error.

FWIW: the behavioral change can be seen on
 [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]
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]
-Status: Open +Status: Closed -Assigned To: +Assigned To: peehaa
 [2015-09-02 14:32 UTC]
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

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2015-09-02 14:53 UTC]
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-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 21:01:33 2024 UTC