Using User::getDefaultOption() in User::setOption() sets preferences like
'language' to the right default value, whereas using $wgDefaultOptions
sets the language to null because language is not part of $wgDefaultUserOptions,
but it is part of return value of User::getDefaultOption().
This only makes problems when reusing the same user object, because when
a new user object is created, the value of 'language' is correct.
Change-Id: I43a32c66fc3997a4f842c63af374e84d234602b2
$this->loadOptions();
// Explicitly NULL values should refer to defaults
- global $wgDefaultUserOptions;
- if( is_null( $val ) && isset( $wgDefaultUserOptions[$oname] ) ) {
- $val = $wgDefaultUserOptions[$oname];
+ if( is_null( $val ) ) {
+ $defaultOption = self::getDefaultOption( $oname );
+ if( !is_null( $defaultOption ) ) {
+ $val = $defaultOption;
+ }
}
$this->mOptions[$oname] = $val;