note 85291 deleted from function.strip-tags by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 08:02:41 +0000 |
| Subject: | note 85291 deleted from function.strip-tags by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196759@lists.php.net to get a copy of this message | ||
Note Submitter: Liam Morland
----
Here is a suggestion for getting rid of attributes: After you run your HTML through strip_tags(),
use the DOM interface to parse the HTML. Recursively walk through the DOM tree and remove any
unwanted attributes. Serialize the DOM back to the HTML string.
Don't make the default permit mistake: Make a list of the attributes you want to ALLOW and
remove any others, rather than removing a specific list, which may be missing something important.