r70599 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70598‎ | r70599 | r70600 >
Date:21:31, 6 August 2010
Author:demon
Status:deferred
Tags:
Comment:
Kill some uses of @. isset() exists for a reason :)
Modified paths:
  • /trunk/extensions/Translate/TranslateUtils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslateUtils.php
@@ -150,7 +150,9 @@
151151
152152 $parts = explode( '-', $code );
153153 $suffix = '';
154 - switch ( @$parts[1] ) {
 154+
 155+ $parts1 = isset( $parts[1] ) ? $parts[1] : '';
 156+ switch ( $parts1 ) {
155157 case 'latn':
156158 $suffix = ' (Latin)'; # TODO: i18n
157159 unset( $parts[1] );
@@ -196,7 +198,7 @@
197199 # $normkey = self::normaliseKey( $namespace, $key );
198200 $normkey = str_replace( " ", "_", strtolower( "$namespace:$key" ) );
199201
200 - $group = @self::$mi[$normkey];
 202+ $group = isset( self::$mi[$normkey] ) ? self::$mi[$normkey] : null;
201203 if ( is_array( $group ) ) {
202204 $group = $group[0];
203205 }
@@ -213,7 +215,11 @@
214216 # $normkey = self::normaliseKey( $namespace, $key );
215217 $normkey = str_replace( " ", "_", strtolower( "$namespace:$key" ) );
216218
217 - return (array) @self::$mi[$normkey];
 219+ if( isset( self::$mi[$normkey] ) ) {
 220+ return (array) self::$mi[$normkey];
 221+ } else {
 222+ return array();
 223+ }
218224 }
219225
220226 public static function normaliseKey( $namespace, $key ) {

Status & tagging log