Fix Undefined offset notice
Also removed some dead code that never ran, there is no variable named "$buckets" so it'll never have an offset. Bug: 45327 Change-Id: I1f70ef0ec4f2434f9f072e718140ff8050b81ba3
This commit is contained in:
@@ -28,11 +28,17 @@ class LanguageNameSearch {
|
||||
if ( self::$languagenames === null ) {
|
||||
self::init();
|
||||
}
|
||||
|
||||
// @todo: Shouldn't this be unicode aware?
|
||||
$searchKey = strtolower( $searchKey );
|
||||
$bucket = self::$languagenames[self::getIndex( $searchKey )];
|
||||
if ( !$bucket ) {
|
||||
$index = self::getIndex( $searchKey );
|
||||
|
||||
if ( !isset( self::$languagenames[$index] ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$bucket = self::$languagenames[$index];
|
||||
|
||||
$results = array();
|
||||
foreach ( $bucket as $name => $code ) {
|
||||
// Prefix search
|
||||
@@ -55,9 +61,6 @@ class LanguageNameSearch {
|
||||
} else {
|
||||
$bucket = $codepoint % 1000;
|
||||
}
|
||||
if ( !isset( $buckets[$bucket] ) ) {
|
||||
$buckets[$bucket] = array();
|
||||
}
|
||||
|
||||
return $bucket;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user