simplepie/simplepie — Issue #177: strip attributes do not work for tags with no inner content
Author: gfreh
Created: 2012-02-15 17:38:54+00:00
State: open

I have noticed that the sanitize process do not remove attributes for tags that have no inner content, such as `` and ``, because the open tag is also the close tag.

Taking a look at the source code, seems that it only handles tag ending with a `>` char, and a simple change on the `preg_replace` parameteres would solve the problem as follows:

```php
$data = preg_replace('/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . trim($attrib) . '(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '(>|\/>)/', '\1\2\3\4', $data);
```