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

Skip to content

[DI] Deprecate non-string default envs #27680

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

Closed
ro0NL opened this issue Jun 22, 2018 · 2 comments
Closed

[DI] Deprecate non-string default envs #27680

ro0NL opened this issue Jun 22, 2018 · 2 comments

Comments

@ro0NL
Copy link
Contributor

ro0NL commented Jun 22, 2018

Symfony version(s) affected: 4.1

Description
Currently it's allowed to do define a scalar value for a default env parameter, e.g. env(SOME): 1.5 (opposed to its string value"1.5") while that's not possible with real env vars (hence we added the prefix processors). It's a trap and as such I think we should deprecate non-string defaults, and force string values in 5.0.

This way we can safely imply a default string:... processor again, and cast to i.e. float using its dedicated float:... processor. It was reverted in #27470 to preserve BC (see #27455), but i tend to agree with @stof in #27470 (comment) this is not correct.

cc @nicolas-grekas

edit: this also requires to forbid setting prefixed defaults, which is possible today but not handled as such. I'd keep this possibility closed until then... today those are silently ignored.

@nicolas-grekas
Copy link
Member

We should allow null at least. We should be sure this solves a real-world issue. Doing it for the sake of it isn't enough a reason IMHO.

@fabpot fabpot closed this as completed Mar 27, 2019
symfony-splitter pushed a commit to symfony/dependency-injection that referenced this issue Mar 27, 2019
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] Deprecate non-string default envs

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes-ish
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass?   | no    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27680, symfony/symfony#27470 (comment)
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This is a failing test to further clarify the issues raised in #27680

So given symfony/symfony#27680 (comment)

> We should be sure this solves a real-world issue.

I think it solves a real bug :)

Commits
-------

2311437c9f [DI] Deprecate non-string default envs
fabpot added a commit that referenced this issue Mar 27, 2019
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] Deprecate non-string default envs

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes-ish
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass?   | no    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27680, #27470 (comment)
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This is a failing test to further clarify the issues raised in #27680

So given #27680 (comment)

> We should be sure this solves a real-world issue.

I think it solves a real bug :)

Commits
-------

2311437 [DI] Deprecate non-string default envs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants