r44965 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44964‎ | r44965 | r44966 >
Date:19:56, 23 December 2008
Author:brion
Status:ok
Tags:
Comment:
Revert r44817 "Delay $wgContLang unstubbing"
Maintainability alert -- creates duplicate code which could become out of sync!
Modified paths:
  • /trunk/phase3/includes/WebRequest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WebRequest.php
@@ -220,10 +220,13 @@
221221 */
222222 function getGPCVal( $arr, $name, $default ) {
223223 if( isset( $arr[$name] ) ) {
 224+ global $wgContLang;
224225 $data = $arr[$name];
225226 if( isset( $_GET[$name] ) && !is_array( $data ) ) {
226227 # Check for alternate/legacy character encoding.
227 - $data = $this->checkTitleEncoding( $data );
 228+ if( isset( $wgContLang ) ) {
 229+ $data = $wgContLang->checkTitleEncoding( $data );
 230+ }
228231 }
229232 $data = $this->normalizeUnicode( $data );
230233 return $data;
@@ -231,21 +234,7 @@
232235 return $default;
233236 }
234237 }
235 -
236 - protected function checkTitleEncoding( $s ) {
237 - global $wgContLang;
238 - if( !isset($wgContLang) ) return $s;
239 - # Check for non-UTF-8 URLs
240 - $ishigh = preg_match( '/[\x80-\xff]/', $s);
241 - if( !$ishigh ) return $s;
242238
243 - $isutf8 = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
244 - '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
245 - if( $isutf8 ) return $s;
246 - # Do the heavy lifting by unstubbing $wgContLang
247 - return $wgContLang->iconv( $wgContLang->fallback8bitEncoding(), "utf-8", $s );
248 - }
249 -
250239 /**
251240 * Fetch a scalar from the input or return $default if it's not set.
252241 * Returns a string. Arrays are discarded. Useful for

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44817Delay $wgContLang unstubbingaaron00:01, 20 December 2008

Status & tagging log