Index: branches/REL1_17/phase3/includes/Sanitizer.php |
— | — | @@ -1107,7 +1107,8 @@ |
1108 | 1108 | * for XML and XHTML specifically. Any stray bits will be |
1109 | 1109 | * &-escaped to result in a valid text fragment. |
1110 | 1110 | * |
1111 | | - * a. any named char refs must be known in XHTML |
| 1111 | + * a. named char refs can only be < > & ", others are |
| 1112 | + * numericized (this way we're well-formed even without a DTD) |
1112 | 1113 | * b. any numeric char refs must be legal chars, not invalid or forbidden |
1113 | 1114 | * c. use &#x, not &#X |
1114 | 1115 | * d. fix or reject non-valid attributes |
— | — | @@ -1146,9 +1147,10 @@ |
1147 | 1148 | |
1148 | 1149 | /** |
1149 | 1150 | * If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD, |
1150 | | - * return the named entity reference as is. If the entity is a |
1151 | | - * MediaWiki-specific alias, returns the HTML equivalent. Otherwise, |
1152 | | - * returns HTML-escaped text of pseudo-entity source (eg &foo;) |
| 1151 | + * return the equivalent numeric entity reference (except for the core < |
| 1152 | + * > & "). If the entity is a MediaWiki-specific alias, returns |
| 1153 | + * the HTML equivalent. Otherwise, returns HTML-escaped text of |
| 1154 | + * pseudo-entity source (eg &foo;) |
1153 | 1155 | * |
1154 | 1156 | * @param $name String |
1155 | 1157 | * @return String |
— | — | @@ -1157,8 +1159,11 @@ |
1158 | 1160 | global $wgHtmlEntities, $wgHtmlEntityAliases; |
1159 | 1161 | if ( isset( $wgHtmlEntityAliases[$name] ) ) { |
1160 | 1162 | return "&{$wgHtmlEntityAliases[$name]};"; |
1161 | | - } elseif( isset( $wgHtmlEntities[$name] ) ) { |
| 1163 | + } elseif ( in_array( $name, |
| 1164 | + array( 'lt', 'gt', 'amp', 'quot' ) ) ) { |
1162 | 1165 | return "&$name;"; |
| 1166 | + } elseif ( isset( $wgHtmlEntities[$name] ) ) { |
| 1167 | + return "&#{$wgHtmlEntities[$name]};"; |
1163 | 1168 | } else { |
1164 | 1169 | return "&$name;"; |
1165 | 1170 | } |
Index: branches/REL1_17/phase3/RELEASE-NOTES |
— | — | @@ -498,6 +498,7 @@ |
499 | 499 | * (bug 1379) Installer directory conflicts with some hosts' configuration panel. |
500 | 500 | * (bug 27781) Installer does not warn about 5.1.x. Added a compatibility function |
501 | 501 | for array_key_exists(). |
| 502 | +* Fix XML well-formedness on a few pages when $wgHtml5 is true (the default) |
502 | 503 | |
503 | 504 | === API changes in 1.17 === |
504 | 505 | * BREAKING CHANGE: action=patrol now requires POST |