Skip to content

Conversation

@pabzm
Copy link
Member

@pabzm pabzm commented Oct 30, 2024

An unspoken (as far as I know) rule of Roundcube config options is that setting an option to null makes Roundcube use the (hardcoded) default, while setting it to false disables it.

This PR introduces a test that checks that behaviour.

@pabzm pabzm requested a review from alecpl October 30, 2024 11:54
@pabzm
Copy link
Member Author

pabzm commented Oct 30, 2024

@johndoh I'd be interested if you have any comments, too! (Can't request a formal review from you.)

@alecpl
Copy link
Member

alecpl commented Oct 30, 2024

I'm not sure you are not mixing two things. This is indeed how set() and get() methods work. However, loading options from a config file will override the defaults. Which also is as intended.

@pabzm
Copy link
Member Author

pabzm commented Oct 30, 2024

Hm, I'm not sure we misunderstand. To be precise: by "hardcoded" I mean the second parameter to get(), not an entry in defaults.inc.php.

I just verified by testing that:

  • if a config option's value is set to null in the config file, get() returns its second parameter,
  • if a config option's value is set to false in the config file, get() returns false.

"The config file" being defaults.inc.php, or (overriding settings from the former) config.inc.php.

@alecpl Do you agree that this is correct and wanted behaviour?

@pabzm
Copy link
Member Author

pabzm commented Nov 5, 2024

@alecpl I'd like your feedback on my last comment here

@alecpl
Copy link
Member

alecpl commented Nov 5, 2024

One could argue that using array_key_exists() would be better than isset(), but this is how it always been so I'd keep that. So, I agree this is correct behavior.

@pabzm
Copy link
Member Author

pabzm commented Nov 5, 2024

One could argue that using array_key_exists() would be better than isset()

I guess you mean this line? https://github.com/roundcube/roundcubemail/blob/master/program/lib/Roundcube/rcube_config.php#L377

That is unchanged since 0ac4160 (from 2012). But I'd be happy to change it if you confirm.

So, I agree this is correct behavior.

Then this PR could be merged in order to actually check this behaviour, I guess? (I'll do it in a few days unless you object.)

@alecpl alecpl merged commit 06c5e01 into master Nov 5, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants