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

Remove whitespace from base-DNs #18484

Merged
merged 3 commits into from
Oct 6, 2015
Merged

Remove whitespace from base-DNs #18484

merged 3 commits into from
Oct 6, 2015

Conversation

Takuto88
Copy link
Contributor

Fixes #17964.

I've tried to implement trimming in Connection::doCriticalValidation() as hinted in the issue. However, this does not work that way. Everything that is changed during that method call is somehow being reset to its original value afterwards. I am not sure why that is. As far as my understanding of the code goes, this should not happen.

Because of this, I've opted to implement trim when saving these specific config values in Configuration::setConfiguration() which works reliably for me.

cc @blizzz: Please review. Thanks

@@ -146,6 +146,7 @@ public function setConfiguration($config, &$applied = null) {
}

$setMethod = 'setValue';
$trim = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

@DeepDiver1975
Copy link
Member

@blizzz

@@ -276,14 +278,18 @@ protected function getMultiLine($varName) {
* @param string $varName
* @param array|string $value
*/
protected function setMultiLine($varName, $value) {
protected function setMultiLine($varName, $value, $trim = false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adjust PHPDoc

@scrutinizer-notifier
Copy link

A new inspection was created.

@Takuto88
Copy link
Contributor Author

Thanks for the feedback. I've updated the file accordingly. Also, the logic has been changed so that trim also works on non-array values on Configuration::setMutliLine() and non string values on Configuration::setValue() are ignored.

@LukasReschke
Copy link
Member

Is it possible to add unit tests for these?

@blizzz
Copy link
Contributor

blizzz commented Aug 24, 2015

Actually we can simplify it and work without the $trim parameter, just trim all the string settings. Trimming is always safe, except for the password. For this we can check in setValue() (ugly) or introduce another where we don't do any manipulation to strings like setUnmodifiedValue() or setRawValue() and apply this method for the password. This could be called from within setMultiLine as well to avoid an extra trim.

@blizzz
Copy link
Contributor

blizzz commented Sep 29, 2015

@Takuto88 an update about #18484 (comment)?

@blizzz blizzz added this to the 8.2-current milestone Oct 2, 2015
@blizzz
Copy link
Contributor

blizzz commented Oct 2, 2015

OK, I finished this as suggested in #18484 (comment) and added unit tests for setting the configuration items.

@davitol @LukasReschke @MorrisJobke review and testing would be awesome

@MorrisJobke
Copy link
Contributor

Tested and works 👍

I rebased this on current master for easier testing.

@davitol
Copy link
Contributor

davitol commented Oct 6, 2015

👍 WFM

DeepDiver1975 added a commit that referenced this pull request Oct 6, 2015
Remove whitespace from base-DNs
@DeepDiver1975 DeepDiver1975 merged commit 1525ef4 into master Oct 6, 2015
@DeepDiver1975 DeepDiver1975 deleted the fix-17964 branch October 6, 2015 07:23
@LukasReschke
Copy link
Member

Potential regression: #19793

@lock lock bot locked as resolved and limited conversation to collaborators Aug 9, 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.

LDAP: when sanitizing, also trim dn
7 participants