8000 Merge branch '6.4' into 7.0 · symfony/symfony@979e10c · GitHub
[go: up one dir, main page]

Skip to content

Commit 979e10c

Browse files
Merge branch '6.4' into 7.0
* 6.4: (21 commits) [ErrorHandler] Add missing self-closing tags on link elements Fix merge (bis) Fix merge Add missing return type [FrameworkBundle] ConfigBuilderCacheWarmer should be non-optional [HttpClient] Fix pausing responses before they start when using curl [Notifier] Updated the NTFY notifier to run without a user parameter [Translation] Fix constant domain resolution in PhpAstExtractor separate child and parent context in NotificationEmail on writes [Mailer] [Mailgun] Fix sender header encoding do not overwrite the cache key when it is false [Mailer] [Scaleway] Fix attachment handling [Mailer] Throw TransportException when unable to read from socket [Serializer] Rewrite `AbstractObjectNormalizer::createChildContext()` to use the provided `cache_key` from original context when creating child contexts Revert #47715 [HttpClient] Fix error chunk creation in passthru Adjusting and removing the 'review' attribute from the pt_br translation XML. [DependencyInjection] Fix loading all env vars from secrets when only a subset is needed Fix option filenameMaxLength to the File constraint (Image) [Serializer] Take unnamed variadic parameters into account when denormalizing ...
2 parents c2fd6b0 + 6f21d07 commit 979e10c

File tree

56 files changed

+483
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+483
-90
lines changed

src/Symfony/Bridge/Twig/Mime/NotificationEmail.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,26 @@ public function getHtmlTemplate(): ?string
174174
return '@email/'.$this->theme.'/notification/body.html.twig';
175175
}
176176

177+
/**
178+
* @return $this
179+
*/
180+
public function context(array $context): static
181+
{
182+
$parentContext = [];
183+
184+
foreach ($context as $key => $value) {
185+
if (\array_key_exists($key, $this->context)) {
186+
$this->context[$key] = $value;
187+
} else {
188+
$parentContext[$key] = $value;
189+
}
190+
}
191+
192+
parent::context($parentContext);
193+
194+
return $this;
195+
}
196+
177197
public function getContext(): array
178198
{
179199
return array_merge($this->context, parent::getContext());

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{# Attribute "required" is not supported #}
1515
{%- set required = false -%}
1616
{%- endif -%}
17-
<input type="{{ type }}" {{ block('widget_attributes') }}{% if value is not empty %} value="{{ value }}"{% endif %}>
17+
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
1818
{%- endblock form_widget_simple -%}
1919

2020
{%- block form_widget_compound -%}
@@ -91,11 +91,11 @@
9191
{%- endblock choice_widget_options -%}
9292

9393
{%- block checkbox_widget -%}
94-
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %}>
94+
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
9595
{%- endblock checkbox_widget -%}
9696

9797
{%- block radio_widget -%}
98-
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %}>
98+
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
9999
{%- endblock radio_widget -%}
100100

101101
{%- block datetime_widget -%}
@@ -402,7 +402,7 @@
402402
{%- endif -%}
403403
<form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %}>
404404
{%- if form_method != method -%}
405-
<input type="hidden" name="_method" value="{{ method }}">
405+
<input type="hidden" name="_method" value="{{ method }}" />
406406
{%- endif -%}
407407
{%- endblock form_start -%}
408408

@@ -440,7 +440,7 @@
440440
{%- endif -%}
441441

442442
{%- if form_method != method -%}
443-
<input type="hidden" name="_method" value="{{ method }}">
443+
<input type="hidden" name="_method" value="{{ method }}" />
444444
{%- endif -%}
445445
{% endif -%}
446446
{% endblock form_rest %}

src/Symfony/Bridge/Twig/Test/FormLayoutTestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ protected function assertMatchesXpath($html, $expression, $count = 1): void
5252
{
5353
$dom = new \DOMDocument('UTF-8');
5454

55-
$html = preg_replace('/(<input [^>]+)(?<!\/)>/', '$1/>', $html);
56-
5755
try {
5856
// Wrap in <root> node so we can load HTML with multiple tags at
5957
// the top level

src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,7 +2797,7 @@ public function testWidgetAttributes()
27972797
$html = $this->renderWidget($form->createView());
27982798

27992799
// compare plain HTML to check the whitespace
2800-
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar form-control" data-foo="bar" value="value">', $html);
2800+
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar form-control" data-foo="bar" value="value" />', $html);
28012801
}
28022802

28032803
public function testWidgetAttributeNameRepeatedIfTrue()
@@ -2809,7 +2809,7 @@ public function testWidgetAttributeNameRepeatedIfTrue()
28092809
$html = $this->renderWidget($form->createView());
28102810

28112811
// foo="foo"
2812-
$this->assertSame('<input type="text" id="text" name="text" required="required" foo="foo" class="form-control" value="value">', $html);
2812+
$this->assertSame('<input type="text" id="text" name="text" required="required" foo="foo" class="form-control" value="value" />', $html);
28132813
}
28142814

28152815
public function testButtonAttributes()

src/Symfony/Bridge/Twig/Tests/Extension/AbstractLayoutTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,7 +2448,7 @@ public function testWidgetAttributes()
24482448
$html = $this->renderWidget($form->createView());
24492449

24502450
// compare plain HTML to check the whitespace
2451-
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar" data-foo="bar" value="value">', $html);
2451+
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar" data-foo="bar" value="value" />', $html);
24522452
}
24532453

24542454
public function testWidgetAttributeNameRepeatedIfTrue()
@@ -2460,7 +2460,7 @@ public function testWidgetAttributeNameRepeatedIfTrue()
24602460
$html = $this->renderWidget($form->createView());
24612461

24622462
// foo="foo"
2463-
$this->assertSame('<input type="text" id="text" name="text" required="required" foo="foo" value="value">', $html);
2463+
$this->assertSame('<input type="text" id="text" name="text" required="required" foo="foo" value="value" />', $html);
24642464
}
24652465

24662466
public function testWidgetAttributeHiddenIfFalse()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% block form_widget_simple %}
22
{%- set type = type|default('text') -%}
3-
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme">
3+
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
44
{%- endblock form_widget_simple %}

src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
{% block form_widget_simple %}
44
{%- set type = type|default('text') -%}
5-
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme">
5+
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
66
{%- endblock form_widget_simple %}

src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_use.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
{% block form_widget_simple %}
44
{%- set type = type|default('text') -%}
5-
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme">
5+
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
66
{%- endblock form_widget_simple %}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testMoneyWidgetInIso()
7171
$this->assertSame(<<<'HTML'
7272
<div class="input-group">
7373
<span class="input-group-addon">&euro; </span>
74-
<input type="text" id="name" name="name" required="required" class="form-control"> </div>
74+
<input type="text" id="name" name="name" required="required" class="form-control" /> </div>
7575
HTML
7676
, trim($this->renderWidget($view)));
7777
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function testMoneyWidgetInIso()
7676
$this->assertSame(<<<'HTML'
7777
<div class="input-group "><div class="input-group-prepend">
7878
<span class="input-group-text">&euro; </span>
79-
</div><input type="text" id="name" name="name" required="required" class="form-control"></div>
79+
</div><input type="text" id="name" name="name" required="required" class="form-control" /></div>
8080
HTML
8181
, trim($this->renderWidget($view)));
8282
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testMoneyWidgetInIso()
7575
->createView();
7676

7777
self::assertSame(<<<'HTML'
78-
<div class="input-group "><span class="input-group-text">&euro; </span><input type="text" id="name" name="name" required="required" class="form-control"></div>
78+
<div class="input-group "><span class="input-group-text">&euro; </span><input type="text" id="name" name="name" required="required" class="form-control" /></div>
7979
HTML
8080
, trim($this->renderWidget($view)));
8181
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function testMoneyWidgetInIso()
156156
->createView()
157157
;
158158

159-
$this->assertSame('&euro; <input type="text" id="name" name="name" required="required">', $this->renderWidget($view));
159+
$this->assertSame('&euro; <input type="text" id="name" name="name" required="required" />', $this->renderWidget($view));
160160
}
161161

162162
public function testHelpAttr()

src/Symfony/Bridge/Twig/Tests/Mime/NotificationEmailTest.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,54 @@ public function testPublicMailSubject()
128128
$headers = $email->getPreparedHeaders();
129129
$this->assertSame('Foo', $headers->get('Subject')->getValue());
130130
}
131+
132+
public function testContext()
133+
{
134+
$email = new NotificationEmail();
135+
$email->context(['some' => 'context']);
136+
137+
$this->assertSame([
138+
'importance' => NotificationEmail::IMPORTANCE_LOW,
139+
'content' => '',
140+
'exception' => false,
141+
'action_text' => null,
142+
'action_url' => null,
143+
'markdown' => false,
144+
'raw' => false,
145+
'footer_text' => 'Notification email sent by Symfony',
146+
'some' => 'context',
147+
], $email->getContext());
148+
149+
$context = $email->getContext();
150+
$context['foo'] = 'bar';
151+
$email->context($context);
152+
153+
$this->assertSame([
154+
'importance' => NotificationEmail::IMPORTANCE_LOW,
155+
'content' => '',
156+
'exception' => false,
157+
'action_text' => null,
158+
'action_url' => null,
159+
'markdown' => false,
160+
'raw' => false,
161+
'footer_text' => 'Notification email sent by Symfony',
162+
'some' => 'context',
163+
'foo' => 'bar',
164+
], $email->getContext());
165+
166+
$email->action('Action Text', 'Action URL');
167+
168+
$this->assertSame([
169+
'importance' => NotificationEmail::IMPORTANCE_LOW,
170+
'content' => '',
171+
'exception' => false,
172+
'action_text' => 'Action Text',
173+
'action_url' => 'Action URL',
174+
'markdown' => false,
175+
'raw' => false,
176+
'footer_text' => 'Notification email sent by Symfony',
177+
'some' => 'context',
178+
'foo' => 'bar',
179+
], $email->getContext());
180+
}
131181
}

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ private function dumpExtension(ExtensionInterface $extension, ConfigBuilderGener
8080

8181
public function isOptional(): bool
8282
{
83-
return true;
83+
return false;
8484
}
8585
}

src/Symfony/Bundle/FrameworkBundle/Secrets/SodiumVault.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Secrets;
1313

1414
use Symfony\Component\DependencyInjection\EnvVarLoaderInterface;
15+
use Symfony\Component\String\LazyString;
1516
use Symfony\Component\VarExporter\VarExporter;
1617

1718
/**
@@ -169,7 +170,14 @@ public function list(bool $reveal = false): array
169170

170171
public function loadEnvVars(): array
171172
{
172-
return $this->list(true);
173+
$envs = [];
174+
$reveal = $this->reveal(...);
175+
176+
foreach ($this->list() as $name => $value) {
177+
$envs[$name] = LazyString::fromCallable($reveal, $name);
178+
}
179+
180+
return $envs;
173181
}
174182

175183
private function loadKeys(): void
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{% extends "base.html.twig" %}
22

33
{% block body %}
4-
Hello {{ app.user.userIdentifier }}!<br><br>
5-
You're browsing to path "{{ app.request.pathInfo }}".<br><br>
4+
Hello {{ app.user.userIdentifier }}!<br /><br />
5+
You're browsing to path "{{ app.request.pathInfo }}".<br /><br />
66
<a href="{{ logout_path('default') }}">Log out</a>.
77
<a href="{{ logout_url('default') }}">Log out</a>.
88
{% endblock %}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Resources/views/Login/login.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{{ form_widget(form) }}
77

88
{# Note: ensure the submit name does not conflict with the form's name or it may clobber field data #}
9-
<input type="submit" name="login">
9+
<input type="submit" name="login" />
1010
</form>
1111

1212
{% endblock %}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Resources/views/Localized/login.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
<form action="{{ path('localized_check_path') }}" method="post">
1010
<label for="username">Username:</label>
11-
<input type="text" id="username" name="_username" value="{{ last_username }}">
11+
<input type="text" id="username" name="_username" value="{{ last_username }}" />
1212

1313
<label for="password">Password:</label>
14-
<input type="password" id="password" name="_password">
14+
<input type="password" id="password" name="_password" />
1515

16-
<input type="hidden" name="_target_path" value="">
16+
<input type="hidden" name="_target_path" value="" />
1717

18-
<input type="submit" name="login">
18+
<input type="submit" name="login" />
1919
</form>
2020

2121
{% endblock %}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Resources/views/Login/after_login.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "base.html.twig" %}
22

33
{% block body %}
4-
Hello {{ user.userIdentifier }}!<br><br>
4+
Hello {{ user.userIdentifier }}!<br /><br />
55
You're browsing to path "{{ app.request.pathInfo }}".
66

77
<a href="{{ logout_path('default') }}">Log out</a>.

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Resources/views/Login/login.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
<form action="{{ path('form_login_check') }}" method="post">
1111
<label for="username">Username:</label>
12-
<input type="text" id="username" name="_username" value="{{ last_username }}">
12+
<input type="text" id="username" name="_username" value="{{ last_username }}" />
1313

1414
<label for="password">Password:</label>
15-
<input type="password" id="password" name="_password">
15+
<input type="password" id="password" name="_password" />
1616

17-
<input type="hidden" name="_target_path" value="">
17+
<input type="hidden" name="_target_path" value="" />
1818

19-
<input type="submit" name="login">
19+
<input type="submit" name="login" />
2020
</form>
2121

2222
{% endblock %}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/templates/base.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<meta charset="{{ _charset }}">
4+
<meta charset="{{ _charset }}" />
55
<title>{% block title %}Welcome!{% endblock %}</title>
66
{% block stylesheets %}{% endblock %}
77
</head>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/notifier.html.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@
134134
<h3 class="tab-title">Notification</h3>
135135
<div class="tab-content">
136136
<pre class="prewrap" style="max-height: 600px">
137-
{{- 'Subject: ' ~ notification.getSubject() }}<br>
138-
{{- 'Content: ' ~ notification.getContent() }}<br>
139-
{{- 'Importance: ' ~ notification.getImportance() }}<br>
140-
{{- 'Emoji: ' ~ (notification.getEmoji() is empty ? '(empty)' : notification.getEmoji()) }}<br>
141-
{{- 'Exception: ' ~ notification.getException() ?? '(empty)' }}<br>
137+
{{- 'Subject: ' ~ notification.getSubject() }}<br/>
138+
{{- 'Content: ' ~ notification.getContent() }}<br/>
139+
{{- 'Importance: ' ~ notification.getImportance() }}<br/>
140+
{{- 'Emoji: ' ~ (notification.getEmoji() is empty ? '(empty)' : notification.getEmoji()) }}<br/>
141+
{{- 'Exception: ' ~ notification.getException() ?? '(empty)' }}<br/>
142142
{{- 'ExceptionAsString: ' ~ (notification.getExceptionAsString() is empty ? '(empty)' : notification.getExceptionAsString()) }}
143143
</pre>
144144
</div>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta charset="{{ _charset }}">
5-
<meta name="robots" content="noindex,nofollow">
6-
<meta name="viewport" content="width=device-width,initial-scale=1">
4+
<meta charset="{{ _charset }}" />
5+
<meta name="robots" content="noindex,nofollow" />
6+
<meta name="viewport" content="width=device-width,initial-scale=1" />
77
<title>{% block title %}Symfony Profiler{% endblock %}</title>
88

99
{% set request_collector = profile is defined ? profile.collectors.request|default(null) : null %}

src/Symfony/Component/DependencyInjection/EnvVarLoaderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
interface EnvVarLoaderInterface
2020
{
2121
/**
22-
* @return string[] Key/value pairs that can be accessed using the regular "%env()%" syntax
22+
* @return array<string|\Stringable> Key/value pairs that can be accessed using the regular "%env()%" syntax
2323
*/
2424
public function loadEnvVars(): array;
2525
}

0 commit comments

Comments
 (0)
0