From de2ce58a4ff41bf91eedb14ad421c620e4c7f8ee Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 1 Nov 2018 18:15:47 +0100 Subject: [PATCH 1/4] [HttpFoundation] replace any preexisting Content-Type headers --- src/Symfony/Component/HttpFoundation/Response.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 6b6308e36c..a4ad0e66ae 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -344,8 +344,9 @@ class Response // headers foreach ($this->headers->allPreserveCase() as $name => $values) { + $replace = 0 === strcasecmp($name, 'Content-Type'); foreach ($values as $value) { - header($name.': '.$value, false, $this->statusCode); + header($name.': '.$value, $replace, $this->statusCode); } } From 1fa5a9a0bdf7ca7d26423609f3c828419eb90e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Tue, 6 Nov 2018 18:42:22 +0100 Subject: [PATCH 2/4] [HttpFoundation] Fixed PHP doc of ParameterBag::getBoolean Since the method should return a bool, then the default value should be a bool too --- src/Symfony/Component/HttpFoundation/ParameterBag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index fdf60e56e9..6141b1bf6f 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -231,7 +231,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * Returns the parameter value converted to boolean. * * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist + * @param bool $default The default value if the parameter key does not exist * @param bool $deep If true, a path like foo[bar] will find deeper items * * @return bool The filtered value From 21a909a189c1f42767c606c0e7607e4af54d8f11 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 8 Nov 2018 09:45:28 +0100 Subject: [PATCH 3/4] [Dotenv] dont use getenv() to read SYMFONY_DOTENV_VARS --- src/Symfony/Component/Dotenv/Dotenv.php | 15 ++++++++------- src/Symfony/Component/Dotenv/Tests/DotenvTest.php | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index 41b83f57a6..025206326a 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -66,8 +66,8 @@ final class Dotenv */ public function populate($values) { - $loadedVars = array_flip(explode(',', getenv('SYMFONY_DOTENV_VARS'))); - unset($loadedVars['']); + $updateLoadedVars = false; + $loadedVars = array_flip(explode(',', isset($_SERVER['SYMFONY_DOTENV_VARS']) ? $_SERVER['SYMFONY_DOTENV_VARS'] : (isset($_ENV['SYMFONY_DOTENV_VARS']) ? $_ENV['SYMFONY_DOTENV_VARS'] : ''))); foreach ($values as $name => $value) { $notHttpName = 0 !== strpos($name, 'HTTP_'); @@ -82,14 +82,15 @@ final class Dotenv $_SERVER[$name] = $value; } - $loadedVars[$name] = true; + if (!isset($loadedVars[$name])) { + $loadedVars[$name] = $updateLoadedVars = true; + } } - if ($loadedVars) { + if ($updateLoadedVars) { + unset($loadedVars['']); $loadedVars = implode(',', array_keys($loadedVars)); - putenv("SYMFONY_DOTENV_VARS=$loadedVars"); - $_ENV['SYMFONY_DOTENV_VARS'] = $loadedVars; - $_SERVER['SYMFONY_DOTENV_VARS'] = $loadedVars; + putenv('SYMFONY_DOTENV_VARS='.$_ENV['SYMFONY_DOTENV_VARS'] = $_SERVER['SYMFONY_DOTENV_VARS'] = $loadedVars); } } diff --git a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php index 7caa75f066..4492c8e9e0 100644 --- a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php +++ b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php @@ -268,7 +268,7 @@ class DotenvTest extends TestCase public function testOverridingEnvVarsWithNamesMemorizedInSpecialVar() { - putenv('SYMFONY_DOTENV_VARS=FOO,BAR,BAZ'); + putenv('SYMFONY_DOTENV_VARS='.$_SERVER['SYMFONY_DOTENV_VARS'] = 'FOO,BAR,BAZ'); putenv('FOO=foo'); putenv('BAR=bar'); From 59003bf27a10cdb55a68818f78d1cc3b0b405272 Mon Sep 17 00:00:00 2001 From: neFAST Date: Tue, 6 Nov 2018 22:28:41 +0100 Subject: [PATCH 4/4] Change button_widget class to btn-primary --- .../Twig/Resources/views/Form/bootstrap_4_layout.html.twig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig index b4e5b0120e..8c6414895b 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig @@ -137,6 +137,11 @@ {{- parent() -}} {%- endblock button_widget %} +{% block submit_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('btn-primary'))|trim}) -%} + {{- parent() -}} +{%- endblock submit_widget %} + {% block checkbox_widget -%} {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} {%- if 'checkbox-custom' in parent_label_class -%}