Last modified: 2014-06-24 20:30:55 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 T44355, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 42355 - $wgDefaultUserOptions['date'] = 'dmyts' causes MWException error when accessing settings
$wgDefaultUserOptions['date'] = 'dmyts' causes MWException error when accessi...
Status: NEW
Product: MediaWiki
Classification: Unclassified
User preferences (Other open bugs)
1.21.x
All All
: Normal minor (vote)
: ---
Assigned To: Nobody - You can work on this!
: code-update-regression
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-22 11:09 UTC by Florian Effenberger
Modified: 2014-06-24 20:30 UTC (History)
5 users (show)

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


Attachments

Description Florian Effenberger 2012-11-22 11:09:55 UTC
In recent snapshots, the setting

$wgDefaultUserOptions['date'] = 'dmyts';

causes an MWException error when accessing settings, at least in certain languages. For 'de' it seems to work, for 'en' and 'fr' it produces an error. Resetting it to

$wgDefaultUserOptions['date'] = 'dmy';
(i.e. without "ts")

seems to cure the problem.
Comment 1 Florian Effenberger 2012-12-18 13:43:42 UTC
In 1.21wmf6 same issue, but this time 'dmy', 'mdy' and 'ymd' also don't work. Only 'ISO 8601' seems to work.
Comment 2 Umherirrender 2014-01-28 18:52:07 UTC
Error message is: Global default 'dmyts' is invalid for field date
thrown in Preferences::getPreferences

Looks like expected, because it is not possible to use a default date preference, which is not defined for the language.

'dmyts' is only known by language = 'de', so other languages cannot used with that.
Comment 3 Tyler Romeo 2014-06-24 17:32:42 UTC
(In reply to Umherirrender from comment #2)
> Error message is: Global default 'dmyts' is invalid for field date
> thrown in Preferences::getPreferences
> 
> Looks like expected, because it is not possible to use a default date
> preference, which is not defined for the language.
> 
> 'dmyts' is only known by language = 'de', so other languages cannot used
> with that.

I think this is valid reasoning. Unless there is an objection, this can be set to WORKSFORME.
Comment 4 Bawolff (Brian Wolff) 2014-06-24 20:07:31 UTC
Also apparently a regression - bug 19237
Comment 5 Tyler Romeo 2014-06-24 20:16:05 UTC
Indeed. Also see r64915
Comment 6 Bawolff (Brian Wolff) 2014-06-24 20:25:09 UTC
> I think this is valid reasoning. Unless there is an objection, this can be
> set to WORKSFORME.

I disagree

Set:

$wgLanguageCode = "fa";
$wgDefaultUserOptions['date'] = 'hebrew';

Go to Special:Preferences. Everything is fine.

Keep the same settings. Go to Special:Preferences?uselang=en (or switch your user user language to en). Exception is thrown.

I consider that behaviour to be pretty broken. Not sure what the fix is. Maybe date preferences should be both the content language options + the user language options (?)
Comment 7 Tyler Romeo 2014-06-24 20:27:04 UTC
(In reply to Bawolff (Brian Wolff) from comment #6)
> I disagree
> 
> Set:
> 
> $wgLanguageCode = "fa";
> $wgDefaultUserOptions['date'] = 'hebrew';
> 
> Go to Special:Preferences. Everything is fine.
> 
> Keep the same settings. Go to Special:Preferences?uselang=en (or switch your
> user user language to en). Exception is thrown.
> 
> I consider that behaviour to be pretty broken. Not sure what the fix is.
> Maybe date preferences should be both the content language options + the
> user language options (?)

Yeah definitely agree with you there.

The solution is to have a fallback method for finding the default. However, it seems the code already has such a mechanism (see the code changes both you and I linked), but for some reason that is not working anymore.
Comment 8 Bawolff (Brian Wolff) 2014-06-24 20:30:55 UTC
(In reply to Tyler Romeo from comment #7)
> (In reply to Bawolff (Brian Wolff) from comment #6)
> > I disagree
> > 
> > Set:
> > 
> > $wgLanguageCode = "fa";
> > $wgDefaultUserOptions['date'] = 'hebrew';
> > 
> > Go to Special:Preferences. Everything is fine.
> > 
> > Keep the same settings. Go to Special:Preferences?uselang=en (or switch your
> > user user language to en). Exception is thrown.
> > 
> > I consider that behaviour to be pretty broken. Not sure what the fix is.
> > Maybe date preferences should be both the content language options + the
> > user language options (?)
> 
> Yeah definitely agree with you there.
> 
> The solution is to have a fallback method for finding the default. However,
> it seems the code already has such a mechanism (see the code changes both
> you and I linked), but for some reason that is not working anymore.

Its because that code is changing the $wgDefaultUserOptions, but the other code is using User::getDefaultOptions(), which caches a modified $wgDefaultUserOptions in a static variable.

Modifying $wgDefaultUserOptions in Preferences::getDateOptions() seems really really hacky to me. This should probably be changed to happen in User::getDefaultOptions(), and possibly also Preferences::getDateOptions() should be using content language, or maybe content language + user language combined. Definitely should not use only user language.

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


Navigation
Links