Last modified: 2012-07-14 23:15:25 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T40399, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38399 - Multiple fallbacks kills server
Multiple fallbacks kills server
Status: RESOLVED INVALID
Product: MediaWiki extensions
Classification: Unclassified
CLDR (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-14 17:29 UTC by jeblad
Modified: 2012-07-14 23:15 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description jeblad 2012-07-14 17:29:42 UTC
If there are multiple fallbacks, which otherwise seems to be supported, then localization of language names dies.

In the current setup nn is used as fallback for nb, and nb for nn. That means there is a loop in the fallbacks, if one fallback is merged into another. I guess there should be some laundering of fallbacks to avoid loops.

There is a few variations over where the server dies, but line 32 in LanguageNames.body.php seems to be interesting

	public static function getNames( $code, $fbMethod = self::FALLBACK_NATIVE, $list = self::LIST_MW ) {
		$xx = self::loadLanguage( $code );
		$native = Language::getLanguageNames( $list === self::LIST_MW_SUPPORTED );

		if ( $fbMethod === self::FALLBACK_NATIVE ) {
			$names = array_merge( $native, $xx );
		} elseif ( $fbMethod === self::FALLBACK_NORMAL ) {
			$fallback = $code;
			$fb = $xx;
			while ( $fallback = Language::getFallbackFor( $fallback ) ) {
				/* Over write the things in fallback with what we have already */
32 >>>>				$fb = array_merge( self::loadLanguage( $fallback ), $fb );
			}

			/* Add native names for codes that are not in cldr */
			$names = array_merge( $native, $fb );

			/* As a last resort, try the native name in Names.php */
			if ( !isset( $names[$code] ) && isset( $native[$code] ) ) {
				$names[$code] = $native[$code];
			}
		} else {
			throw new MWException( "Invalid value for 2:\$fallback in ".__METHOD__ );
		}

		switch ( $list ) {
			case self::LIST_MW:
			case self::LIST_MW_SUPPORTED:
				/* Remove entries that are not in fb */
				$names = array_intersect_key( $names, $native );
				/* And fall to the return */
			case self::LIST_MW_AND_CLDR:
				return $names;
			default:
				throw new MWException( "Invalid value for 3:\$list in ".__METHOD__ );
		}

	}

Another place seems to be line number 103

	public static function coreHook( &$names, $code ) {
103 >>>		$names += self::getNames( $code, self::FALLBACK_NORMAL, self::LIST_MW_AND_CLDR );
		return true;
	}

Note that the real problem could be somewhere else as the server is killed because of a timeout.

Note that this bug could be important for the Wikibase extension, if we choose to use the existing fallback chains for our global language fallbacks.
Comment 1 jeblad 2012-07-14 17:36:47 UTC
Pathset that is blocked by this https://gerrit.wikimedia.org/r/#/c/15433/
Comment 2 Niklas Laxström 2012-07-14 20:23:18 UTC
Use (later) version of the CLDR extension that is compatible with your version of MediaWiki. I'm sorry for the inconvenience for lack of proper dependency tracking.
Comment 3 jeblad 2012-07-14 23:15:25 UTC
Updated to bleeding edge for dev site and the bug was gone. Thanks!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links