(bug 20655) If $wgHtml5 is false, run attribute values through Sanitizer::encodeAttri...
authorAlex Z <mrzman@users.mediawiki.org>
Wed, 16 Sep 2009 05:29:44 +0000 (05:29 +0000)
committerAlex Z <mrzman@users.mediawiki.org>
Wed, 16 Sep 2009 05:29:44 +0000 (05:29 +0000)
includes/Html.php

index bece509..1010fc3 100644 (file)
@@ -335,13 +335,17 @@ class Html {
                                # and we don't need <> escaped here, we may as well not call
                                # htmlspecialchars().  FIXME: verify that we actually need to
                                # escape \n\r\t here, and explain why, exactly.
-                               $ret .= " $key=$quote" . strtr( $value, array(
-                                       '&' => '&amp;',
-                                       '"' => '&quot;',
-                                       "\n" => '&#10;',
-                                       "\r" => '&#13;',
-                                       "\t" => '&#9;'
-                               ) ) . $quote;
+                               if ( $wgHtml5 ) {
+                                       $ret .= " $key=$quote" . strtr( $value, array(
+                                               '&' => '&amp;',
+                                               '"' => '&quot;',
+                                               "\n" => '&#10;',
+                                               "\r" => '&#13;',
+                                               "\t" => '&#9;'
+                                       ) ) . $quote;
+                               } else {
+                                       $ret .= " $key=$quote" . Sanitizer::encodeAttribute( $value ) . $quote;
+                               }
                        }
                }
                return $ret;