From 64dce47ade71494091646bc88947cfca24d2b060 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Tue, 2 Mar 2010 22:11:08 +0000 Subject: [PATCH] Improve kses handling of attributes in valid XHTML self closed img tags. Fixes #12394 props dougal. git-svn-id: https://develop.svn.wordpress.org/trunk@13561 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/kses.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/kses.php b/wp-includes/kses.php index 29046f19d5..c6bf57a847 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -538,7 +538,7 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) { # Is there a closing XHTML slash at the end of the attributes? $xhtml_slash = ''; - if (preg_match('%\s/\s*$%', $attr)) + if (preg_match('%\s*/\s*$%', $attr)) $xhtml_slash = ' /'; # Are any attributes allowed at all for this element? @@ -664,7 +664,7 @@ function wp_kses_hair($attr, $allowed_protocols) { case 2 : # attribute value, a URL after href= for instance - if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) + if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match)) # "value" { $thisval = $match[1]; @@ -680,7 +680,7 @@ function wp_kses_hair($attr, $allowed_protocols) { break; } - if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) + if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match)) # 'value' { $thisval = $match[1]; @@ -696,7 +696,7 @@ function wp_kses_hair($attr, $allowed_protocols) { break; } - if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) + if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match)) # value { $thisval = $match[1];