Opened 17 years ago
Closed 17 years ago
#5648 closed defect (bug) (duplicate)
Attributes of self-closing HTML tags being erased by sanitize_post_field
Reported by: | dreamer12345 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.3.1 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
Hello,
I found a bug with some "self-closing tags" (like <img ... />) when they are in a field which is processed by the function sanitize_post_field. The bug occurs when there are no spaces between the last attribute of a self-closing tag and the "/>", for example:
<img src="picture.jpg"/>
instead of
<img src="picture.jpg" />
When the first is processed by sanitize_post_field (the one with no space between src="picture.jpg" and />), it is transformed to:
<img>
(Yes "<img>" and nothing else).
I discovered this bug by using sanitize_post_field like this:
sanitize_post_field('post_content', force_balance_tags($my_content), $post_ID, 'db');
(At the beginning I just had <img src="picture.jpg">, it was transformed to <img src="picture.jpg"/> by force_balance_tags and retransformed to <img> by sanitize_post_field)
Thank you for your attention,
Frédéric.
Duplicate of #4723