Skip to content

Fix the validation of incompatible options #138

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

Merged
merged 1 commit into from
Apr 5, 2017

Conversation

stof
Copy link
Contributor

@stof stof commented Apr 5, 2017

Q A
Bug fix? yes
New feature? no
BC breaks? not really
Deprecations? no
Related tickets n/a
Documentation n/a
License MIT

All clients must be validated, not only the first one (which was the case due to returning during the first iteration of the loop over clients).
The easiest way to handle it is to put the validation inside the prototype node, so that each client is validated separately. This also allows to have a better error message (as the error message will tell you which client is invalid as the error will be inside the client configuration node).
The error message is also fixed to talk about the third incompatible features.

I answered not really for BC breaks, because there is a small change. If someone configures incompatible features in a client other than the first one, the DI configuration layer was not rejecting it previously.
But this is not a huge issue, because configuring both would not work properly today anyway (which is why features are marked as incompatible), as they would only get access to features of the last one (as other ones would be hidden inside the decorator stack)

All clients must be validated, not only the first one (which was the case
due to returning during the first iteration of the loop over clients).
The easiest way to handle it is to put the validation inside the prototype
node, so that each client is validated separately. This also allows to have
a better error message (as the error message will tell you which client is
invalid as the error will be inside the client configuration node).
The error message is also fixed to talk about the third incompatible features.
@Nyholm Nyholm self-requested a review April 5, 2017 16:08
Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

I would not consider this a BC break. It is a bug fixed.

Thank you !

@stof
Copy link
Contributor Author

stof commented Apr 5, 2017

@Nyholm I totally agree with you about it being a bug fix. I just wanted to be 100% honest about the implication.

@Nyholm
Copy link
Member

Nyholm commented Apr 5, 2017

That you. That is appreciated.

@Nyholm Nyholm merged commit 2bcd28d into php-http:master Apr 5, 2017
@stof stof deleted the better_config_validation branch April 5, 2017 16:55
@dbu
Copy link
Collaborator

dbu commented Apr 6, 2017

indeed, thanks @stof

re BC: i am also much less afraid of a change that might hit people when they update the bundle over a change that might be "hidden" and only show up under certain conditions at runtime. if somebody has borked configuration, they will immediately see when updating the bundle as the container can't be built anymore. and if they do that directly production then they better learn now than later...

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