Skip to content

Commit f45252a

Browse files
Merge branch '3.4' into 4.1
* 3.4: Change button_widget class to btn-primary [Dotenv] dont use getenv() to read SYMFONY_DOTENV_VARS [HttpFoundation] Fixed PHP doc of ParameterBag::getBoolean [HttpFoundation] replace any preexisting Content-Type headers
2 parents ca5b64d + 5916bbe commit f45252a

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@
149149
{{- parent() -}}
150150
{%- endblock button_widget %}
151151

152+
{% block submit_widget -%}
153+
{%- set attr = attr|merge({class: (attr.class|default('btn-primary'))|trim}) -%}
154+
{{- parent() -}}
155+
{%- endblock submit_widget %}
156+
152157
{% block checkbox_widget -%}
153158
{%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
154159
{%- if 'checkbox-custom' in parent_label_class -%}

src/Symfony/Component/Dotenv/Dotenv.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function load(string $path, string ...$paths): void
6767
*/
6868
public function populate(array $values): void
6969
{
70-
$loadedVars = array_flip(explode(',', getenv('SYMFONY_DOTENV_VARS')));
71-
unset($loadedVars['']);
70+
$updateLoadedVars = false;
71+
$loadedVars = array_flip(explode(',', $_SERVER['SYMFONY_DOTENV_VARS'] ?? $_ENV['SYMFONY_DOTENV_VARS'] ?? '')));
7272

7373
foreach ($values as $name => $value) {
7474
$notHttpName = 0 !== strpos($name, 'HTTP_');
@@ -83,14 +83,15 @@ public function populate(array $values): void
8383
$_SERVER[$name] = $value;
8484
}
8585

86-
$loadedVars[$name] = true;
86+
if (!isset($loadedVars[$name])) {
87+
$loadedVars[$name] = $updateLoadedVars = true;
88+
}
8789
}
8890

89-
if ($loadedVars) {
91+
if ($updateLoadedVars) {
92+
unset($loadedVars['']);
9093
$loadedVars = implode(',', array_keys($loadedVars));
91-
putenv("SYMFONY_DOTENV_VARS=$loadedVars");
92-
$_ENV['SYMFONY_DOTENV_VARS'] = $loadedVars;
93-
$_SERVER['SYMFONY_DOTENV_VARS'] = $loadedVars;
94+
putenv('SYMFONY_DOTENV_VARS='.$_ENV['SYMFONY_DOTENV_VARS'] = $_SERVER['SYMFONY_DOTENV_VARS'] = $loadedVars);
9495
}
9596
}
9697

src/Symfony/Component/Dotenv/Tests/DotenvTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function testMemorizingLoadedVarsNamesInSpecialVar()
268268

269269
public function testOverridingEnvVarsWithNamesMemorizedInSpecialVar()
270270
{
271-
putenv('SYMFONY_DOTENV_VARS=FOO,BAR,BAZ');
271+
putenv('SYMFONY_DOTENV_VARS='.$_SERVER['SYMFONY_DOTENV_VARS'] = 'FOO,BAR,BAZ');
272272

273273
putenv('FOO=foo');
274274
putenv('BAR=bar');

src/Symfony/Component/HttpFoundation/ParameterBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function getInt($key, $default = 0)
174174
* Returns the parameter value converted to boolean.
175175
*
176176
* @param string $key The parameter key
177-
* @param mixed $default The default value if the parameter key does not exist
177+
* @param bool $default The default value if the parameter key does not exist
178178
*
179179
* @return bool The filtered value
180180
*/

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,9 @@ public function sendHeaders()
330330

331331
// headers
332332
foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
333+
$replace = 0 === strcasecmp($name, 'Content-Type');
333334
foreach ($values as $value) {
334-
header($name.': '.$value, false, $this->statusCode);
335+
header($name.': '.$value, $replace, $this->statusCode);
335336
}
336337
}
337338

0 commit comments

Comments
 (0)