r45766 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45765‎ | r45766 | r45767 >
Date:10:26, 15 January 2009
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
Fix regression from r45749: only UTF-8 normalize strings
Modified paths:
  • /trunk/phase3/includes/normal/UtfNormal.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/normal/UtfNormal.php
@@ -72,6 +72,9 @@
7373 * @return string a clean, shiny, normalized UTF-8 string
7474 */
7575 static function cleanUp( $string ) {
 76+ if( !is_string( $string ) ) {
 77+ return $string;
 78+ }
7679 if( NORMALIZE_ICU ) {
7780 # We exclude a few chars that ICU would not.
7881 $string = preg_replace(

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45749API: Clean up invalid UTF-8 in the result before feeding it to the formatter....catrope21:22, 14 January 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   21:59, 20 January 2009

This seems like it'll propagate mistakes... passing an array or object in should probably produce a clear error.

We're also no longer producing guaranteed-string output for string-compatible input, which feels inconsistent. If your calling code was feeding non-string data in and expecting non-strings back, your calling code needs to be fixed.

#Comment by Catrope (talk | contribs)   22:02, 20 January 2009

I'm calling this function using array_walk() on an array that may contain objects, and I didn't feel like using a wrapper function that checks whether the input is a string before calling cleanUp(). I'll use the wrapper function anyway.

#Comment by Catrope (talk | contribs)   09:27, 21 January 2009

Fixed in r45956

Status & tagging log