From: Brion Vibber Date: Thu, 2 Sep 2004 08:01:13 +0000 (+0000) Subject: One more unicode normalization fix: don't die horribly on arrays, and get the PATH_IN... X-Git-Tag: 1.5.0alpha1~2158 X-Git-Url: http://git.cyclocoop.org//%22%22.str_replace%28%27%22%27%2C?a=commitdiff_plain;h=81e0b9d3c0c2bad288a3d73a38738070092db467;p=lhc%2Fweb%2Fwiklou.git One more unicode normalization fix: don't die horribly on arrays, and get the PATH_INFO title too. --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 04742bb0a8..1ebc2438d7 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -27,7 +27,10 @@ class WebRequest { $this->checkMagicQuotes(); global $wgUseLatin1; if( !$wgUseLatin1 ) { - $this->normalizeUnicode(); + require_once( 'normal/UtfNormal.php' ); + wfProfileIn( 'WebRequest:normalizeUnicode-fix' ); + $this->normalizeUnicode( $_REQUEST ); + wfProfileOut( 'WebRequest:normalizeUnicode-fix' ); } } @@ -53,15 +56,14 @@ class WebRequest { } } - function normalizeUnicode() { - wfProfileIn( 'WebRequest:normalizeUnicode-include' ); - require_once( 'normal/UtfNormal.php' ); - wfProfileOut( 'WebRequest:normalizeUnicode-include' ); - wfProfileIn( 'WebRequest:normalizeUnicode-fix' ); - foreach( $_REQUEST as $key => $val ) { - $_REQUEST[$key] = UtfNormal::toNFC( $val ); + function normalizeUnicode( &$arr ) { + foreach( $arr as $key => $val ) { + if( is_array( $val ) ) { + $this->normalizeUnicode( $arr[$key ] ); + } else { + $arr[$key] = UtfNormal::toNFC( $val ); + } } - wfProfileOut( 'WebRequest:normalizeUnicode-fix' ); } function getGPCVal( &$arr, $name, $default ) { diff --git a/index.php b/index.php index 045b0a114c..8f60e00da8 100644 --- a/index.php +++ b/index.php @@ -28,6 +28,10 @@ $action = $wgRequest->getVal( "action", "view" ); if( isset( $_SERVER['PATH_INFO'] ) && $wgUsePathInfo ) { $title = substr( $_SERVER['PATH_INFO'], 1 ); + if( !$wgUseLatin1 ) { + require_once( 'includes/normal/UtfNormal.php' ); + $title = UtfNormal::toNFC( $title ); + } } else { $title = $wgRequest->getVal( "title" ); }