Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DI] Fix accepting null as default env param value #20512

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
Nov 15, 2016

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Nov 14, 2016

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #20447
License MIT
Doc PR -

@stof
Copy link
Member

stof commented Nov 14, 2016

but shouldn't we allow it ? It would be useful in case some config treats null as being "don't enable this feature", which is the case for the database_url in Doctrine (allowing to configure with username/password/host locally when not setting the URL)

@nicolas-grekas
Copy link
Member Author

Could be, but should be allowed for all parameters then (for consistency, and because we use the same code paths for all params, env or not)

@stof
Copy link
Member

stof commented Nov 14, 2016

normal parameters (non-env-based) allow to store null (they also allow to store arrays, contrary to env parameters)

@nicolas-grekas nicolas-grekas force-pushed the env-no-null branch 2 times, most recently from 9b424a1 to c78e090 Compare November 14, 2016 11:10
@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Nov 14, 2016

Indeed, I messed up here :) Fixed!

@nicolas-grekas nicolas-grekas changed the title [DI] Fix misleading exception message [DI] Fix accepting null as default env param value Nov 14, 2016
public function testResolveEnvAllowsNull()
{
$bag = new EnvPlaceholderParameterBag();
$bag->get('env(NULL)');
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit confusing in this test to use NULL as the var name. What about replacing it by NULL_VAR ? (and Null_Var in the example below)

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@dunglas
Copy link
Member

dunglas commented Nov 14, 2016

👍

@xabbuh
Copy link
Member

xabbuh commented Nov 15, 2016

👍

Status: Reviewed

@fabpot
Copy link
Member

fabpot commented Nov 15, 2016

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 7625166 into symfony:master Nov 15, 2016
fabpot added a commit that referenced this pull request Nov 15, 2016
…s-grekas)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[DI] Fix accepting null as default env param value

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |  #20447
| License       | MIT
| Doc PR        | -

Commits
-------

7625166 [DI] Fix accepting null as default env param value
@nicolas-grekas nicolas-grekas deleted the env-no-null branch November 16, 2016 10:15
@fabpot fabpot mentioned this pull request Nov 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants