Exclude null values for flag UserOptionsManager::EXCLUDE_DEFAULTS
isset returns false for null and the null values are not compared, that treats them as non-default, even the default is also null. Bug: T291748 Follow-Up: I6e61c11d8aed27b4b559e74849e0056e5eef3638 Change-Id: I0a0932b403098967c261eee3dc0e7d5da3c4fffb
This commit is contained in:
parent
bba758a65c
commit
7e24705bcd
2 changed files with 1 additions and 2 deletions
|
|
@ -176,7 +176,7 @@ class UserOptionsManager extends UserOptionsLookup {
|
|||
if ( $flags & self::EXCLUDE_DEFAULTS ) {
|
||||
$defaultOptions = $this->defaultOptionsLookup->getDefaultOptions();
|
||||
foreach ( $options as $option => $value ) {
|
||||
if ( isset( $defaultOptions[$option] )
|
||||
if ( array_key_exists( $option, $defaultOptions )
|
||||
&& $this->isValueEqual( $value, $defaultOptions[$option] )
|
||||
) {
|
||||
unset( $options[$option] );
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ class UserOptionsManagerTest extends UserOptionsLookupTest {
|
|||
$expected = [
|
||||
// Note that the old, relaxed array_diff-approach considered null equal to false and ""
|
||||
'null_vs_false' => false,
|
||||
'null_vs_string' => '',
|
||||
'language' => 'en',
|
||||
'variant' => 'en',
|
||||
'new_option' => 'new_value',
|
||||
|
|
|
|||
Loading…
Reference in a new issue