[wp-trac] [WordPress Trac] #5648: Attributes of self-closing HTML
tags being erased by sanitize_post_field
WordPress Trac
wp-trac at lists.automattic.com
Sat Jan 12 03:26:43 GMT 2008
#5648: Attributes of self-closing HTML tags being erased by sanitize_post_field
--------------------------+-------------------------------------------------
Reporter: dreamer12345 | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.3.3
Component: General | Version: 2.3.1
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
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.
--
Ticket URL: <http://trac.wordpress.org/ticket/5648>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list