Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make enable_avatars setting more robust #21953

Merged
merged 1 commit into from Feb 1, 2016

Conversation

MorrisJobke
Copy link
Contributor

@nickvergessen @rullzer @LukasReschke @Pookay Please review

@karlitschek We maybe want to backport this ;)

* handles the setting in the same way everywhere
* fixes #21949
@MorrisJobke MorrisJobke added this to the 9.0-current milestone Jan 27, 2016
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @rullzer, @DeepDiver1975 and @LukasReschke to be potential reviewers

@karlitschek
Copy link
Contributor

please backport. 👍

@nickvergessen
Copy link
Contributor

I don't think this is needed.

@MorrisJobke
Copy link
Contributor Author

I don't think this is needed.

Be more precise please.

Set it to:

  • true -> it is always evaluated as true
  • 'everyString' -> it is sometimes evaluated as true (where no explicit check is done - if($config)) and sometimes evaluated as false where the check is specified (if($config === true)
  • false -> is is always evaluated as false

This change unified the overall behavior to: 'randomString' means false

@DeepDiver1975
Copy link
Member

We have this 'issue' with multiple config settings.

@MorrisJobke
Copy link
Contributor Author

We have this 'issue' with multiple config settings.

That's because we have no proper options validation/casting and unified defaults management.

@nickvergessen
Copy link
Contributor

Well we could do casting based on the provided default value...

Anyway this is at least nothign we should backport, because it is a behaviour change

@MorrisJobke
Copy link
Contributor Author

Well we could do casting based on the provided default value...

-.- Really? This could break everything.

@nickvergessen
Copy link
Contributor

Well with null being an exception, but everytime we set a default its of the type we want to have, anyway your patch here is changing behaviour as well, because '1' previously was enabled, and now it's disabled...
From my pov we shouldn't touch something like this until we have a final outcome about casting in general...

@MorrisJobke
Copy link
Contributor Author

anyway your patch here is changing behaviour as well, because '1' previously was enabled, and now it's disabled...

Not really. Because it was enabled in some code paths and disabled in other code paths, which actually cause the issue this is fixing. The issue was, that it tried to load avatars(setting was evaluated to true) even if the markup to put them in is not present (setting was evaluated to false). This only aligns all usages of the setting to evaluate in the same way.

@DeepDiver1975
Copy link
Member

TBH: the real issue is that the value in the config file was simply wrong - which was caused by the occ command.

@MorrisJobke
Copy link
Contributor Author

TBH: the real issue is that the value in the config file was simply wrong - which was caused by the occ command.

I would nevertheless make all checks be proof against this. Either all check for true or all use the plain if($value) format. But definitely not the mixed stuff, because PHP is sometimes hard to tame and we should avoid this. At least in this case where the actual issue is really hard to notice easy. (compared to a typo in the config.php or a plain wrong DB password, etc)

@nickvergessen
Copy link
Contributor

We can also check the type of all known values and display warnings on the admin page 🙊

@DeepDiver1975
Copy link
Member

Seriously - let's just assume users editing the config file are capable to read.

As said above: the original issue was raised because of the config command was not capable to set the boolean value properly

@MorrisJobke
Copy link
Contributor Author

Could we get back to topic and simply review this change. Even if it is stupid - it doesn't hurt to merge it and it fixes a problem that exists in the real world. The actual problem here is that PHP is dynamically typed and we as developers failed to use a value in the same way everywhere. So this is a pragmatic approach to fix it and it doesn't make anything more complex.

@PVince81
Copy link
Contributor

PVince81 commented Feb 1, 2016

👍

1 similar comment
@DeepDiver1975
Copy link
Member

👍

DeepDiver1975 added a commit that referenced this pull request Feb 1, 2016
@DeepDiver1975 DeepDiver1975 merged commit e23cd35 into master Feb 1, 2016
@DeepDiver1975 DeepDiver1975 deleted the make-enable_avatars-more-robust branch February 1, 2016 13:08
@MorrisJobke
Copy link
Contributor Author

backport is in #22047

@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting enable_avatar to false with occ causes some bugs
6 participants