themselves unless they are given the 'unblockself' permission.
* (bug 22876) Avoid possible PHP Notice if $wgDefaultUserOptions is not
correctly set
+* (bug 14952) Page titles are renormalized after html entities are removed so that
+ links with non-NFC character references work correctly.
== API changes in 1.17 ==
* (bug 22738) Allow filtering by action type on query=logevent
$text );
}
+ /**
+ * Decode any character references, numeric or named entities,
+ * in the next and normalize the resulting string. (bug 14952)
+ *
+ * This is useful for page titles, not for text to be displayed,
+ * MediaWiki allows HTML entities to escape normalization as a feature.
+ *
+ * @param $text String (already normalized, containing entities)
+ * @return String (still normalized, without entities)
+ */
+ public static function decodeCharReferencesAndNormalize( $text ) {
+ global $wgContLang;
+ $text = preg_replace_callback(
+ MW_CHAR_REFS_REGEX,
+ array( 'Sanitizer', 'decodeCharReferencesCallback' ),
+ $text, /* limit */ -1, $count );
+
+ if ( $count ) {
+ return $wgContLang->normalize( $text );
+ } else {
+ return $text;
+ }
+ }
+
/**
* @param $matches String
* @return String
}
/**
- * Convert things like é ā or 〗 into real text...
+ * Convert things like é ā or 〗 into normalized(bug 14952) text
*/
- $filteredText = Sanitizer::decodeCharReferences( $text );
+ $filteredText = Sanitizer::decodeCharReferencesAndNormalize( $text );
$t = new Title();
$t->mDbkeyform = str_replace( ' ', '_', $filteredText );
</p>
!!end
+!! article
+אַ
+!! text
+Test for unicode normalization
+
+The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
+!! endarticle
+
+!! test
+(bug 19451) Links should refer to the normalized form.
+!! input
+[[אַ]]
+[[אַ]]
+[[אַ]]
+[[אַ]]
+[[אַ]]
+!! result
+<p><a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
+<a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
+<a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
+<a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
+<a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
+</p>
+!! end
+
!! test
Empty attribute crash test (bug 2067)
!! input