You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #31731 [DI] remove support for non-string default env() parameters (ro0NL)
This PR was merged into the 5.0-dev branch.
Discussion
----------
[DI] remove support for non-string default env() parameters
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
See #27808
Commits
-------
614f5da [DI] remove support for non-string default env() parameters
Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php
+4-23Lines changed: 4 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -45,16 +45,8 @@ public function get($name)
45
45
if (!preg_match('/^(?:\w*+:)*+\w++$/', $env)) {
46
46
thrownewInvalidArgumentException(sprintf('Invalid %s name: only "word" characters are allowed.', $name));
47
47
}
48
-
49
-
if ($this->has($name)) {
50
-
$defaultValue = parent::get($name);
51
-
52
-
if (null !== $defaultValue && !is_scalar($defaultValue)) { // !is_string in 5.0
53
-
//throw new RuntimeException(sprintf('The default value of an env() parameter must be a string or null, but "%s" given to "%s".', \gettype($defaultValue), $name));
54
-
thrownewRuntimeException(sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', \gettype($defaultValue), $name));
@trigger_error(sprintf('A non-string default value of an env() parameter is deprecated since 4.3, cast "%s" to string instead.', $name), E_USER_DEPRECATED);
thrownewRuntimeException(sprintf('The default value of an env() parameter must be a string or null, but "%s" given to "%s".', \gettype($defaultValue), $name));
if (is_numeric($default = $this->parameters[$name])) {
153
-
if (!\is_string($default)) {
154
-
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
0 commit comments