From b733aea2598358cf27189d5fdebc02e11b11ec8d Mon Sep 17 00:00:00 2001 From: Denis Brumann Date: Sat, 6 Apr 2019 15:12:45 +0200 Subject: [PATCH 1/2] Adds deprecation for non-string env values. --- configuration/environment_variables.rst | 31 ++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/configuration/environment_variables.rst b/configuration/environment_variables.rst index 50a2bd77daf..c253b96810f 100644 --- a/configuration/environment_variables.rst +++ b/configuration/environment_variables.rst @@ -77,7 +77,7 @@ whenever the corresponding environment variable is *not* found: # config/services.yaml parameters: - env(DATABASE_HOST): localhost + env(DATABASE_HOST): 'localhost' .. code-block:: xml @@ -97,6 +97,35 @@ whenever the corresponding environment variable is *not* found: // config/services.php $container->setParameter('env(DATABASE_HOST)', 'localhost'); +.. deprecated:: 4.3 + + Passing non-string values as default values for environment variables is no longer supported. Any non-string value, + e.g. an integer or float must be passed as string. + + .. code-block:: yaml + + # config/services.yaml + parameters: + env(DATABASE_PORT): '3306' + + .. code-block:: xml + + + + + + + 3306 + + + + .. code-block:: php + + // config/services.php + $container->setParameter('env(DATABASE_PORT)', '3306'); + .. _configuration-env-var-in-prod: Configuring Environment Variables in Production From 77f390b70db68c0ac3a6e301c2c237ad237c8a19 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 6 Apr 2019 15:50:29 +0200 Subject: [PATCH 2/2] Made the deprecation notice more concise --- configuration/environment_variables.rst | 31 ++++--------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/configuration/environment_variables.rst b/configuration/environment_variables.rst index c253b96810f..8ea248cac30 100644 --- a/configuration/environment_variables.rst +++ b/configuration/environment_variables.rst @@ -99,32 +99,9 @@ whenever the corresponding environment variable is *not* found: .. deprecated:: 4.3 - Passing non-string values as default values for environment variables is no longer supported. Any non-string value, - e.g. an integer or float must be passed as string. - - .. code-block:: yaml - - # config/services.yaml - parameters: - env(DATABASE_PORT): '3306' - - .. code-block:: xml - - - - - - - 3306 - - - - .. code-block:: php - - // config/services.php - $container->setParameter('env(DATABASE_PORT)', '3306'); + Passing non-string values as default values for environment variables is + deprecated since Symfony 4.3. Use :ref:`environment variable processors ` + if you need to transform those string default values into other data types. .. _configuration-env-var-in-prod: @@ -161,6 +138,8 @@ the following: :doc:`Symfony profiler `. In practice this shouldn't be a problem because the web profiler must **never** be enabled in production. +.. _env-var-processors: + Environment Variable Processors -------------------------------