[DependencyInjection] Add defined prefix for env var processor#50791
Conversation
|
|
I tried with bool first, but any other value than '1' or 'true' get interpreted as false: |
GromNaN
left a comment
There was a problem hiding this comment.
Sounds like a useful feature.
That's unexpected. We use FILTER_VALIDATE_BOOL, which handles way more cases. The test suite is also proving that. |
;) personally im not to fond of turning we do this in runtime for some env: however, in hindsight i'd split it into 2 envs, rather than 1 conditional env, thus: |
nicolas-grekas
left a comment
There was a problem hiding this comment.
On second thought, we already do have the NO_COLOR env vars which works like that, and this is indeed not the same as bool.
On the behavior side, this should not throw when the env var is not defined. It does current if I'm not wrong.
The check should be moved below the code handling "default" and should account for not found vars. I would also not use empty but use a comparison to the empty string only.
@nicolas-grekas maybe check for |
|
|
|
Fixed the checks and added a few test cases |
|
@nicolas-grekas but as we don't use |
|
Thank you @GaryPEGEOT. |
Allow to add a
definedprefix:Returns
falseif the env var doesn't exist or if it's null or the empty string.Returns
trueotherwise.