Last modified: 2011-08-18 16:41:29 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 T32216, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30216 - Improve language fallback loop detection
Improve language fallback loop detection
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
unspecified
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 30217
  Show dependency treegraph
 
Reported: 2011-08-04 11:27 UTC by Waldir
Modified: 2011-08-18 16:41 UTC (History)
2 users (show)

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


Attachments
Proposed patch (4.30 KB, patch)
2011-08-05 09:32 UTC, Niklas Laxström
Details

Description Waldir 2011-08-04 11:27:09 UTC
The current language fallback loop detection code (in languages/Language.php) actually doesn't detect a loop, but rather stops a fallback chain when it gets larger than 5 items. It would be more logical (and more flexible) to keep track of what languages have been "visited" and break the loop if we return to one of them. In any case, it wouldn't be possible to build an infinite chain of unique language codes, so no arbitrary limit to feedback chains needs to be enforced.
Comment 1 Waldir 2011-08-04 13:55:23 UTC
I think this doesn't actually block 30217, since the current mechanism would allow such a fallback loop to work (actually, it'd be treated as a chain and would be cutoff after 5 iterations, in case none of the localizations exist).
Comment 2 Niklas Laxström 2011-08-04 14:01:50 UTC
Except that the cutoff is an exception which halts code execution :/
Comment 3 Niklas Laxström 2011-08-05 09:32:01 UTC
Created attachment 8890 [details]
Proposed patch

Here is patch that makes the fallbacks a flat list instead of recursive chains. This way we avoid the problems with cycles, because we don't have them anymore.

Not included in the patch: updating $fallback in message files nor updating callers of getFallbackFor (which I plan to deprecate, perhaps with some heuristics to avoid causing loops for callers)
Comment 4 Niklas Laxström 2011-08-18 16:41:29 UTC
r94907.

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


Navigation
Links