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

Skip to content

Commit c290fc0

Browse files
Merge branch '6.4' into 7.0
* 6.4: [TwigBridge] foundation 5 layout: use form_label_content block for checkbox and radio labels [TwigBridge] Fix compat with Twig v3.9 [Cache] Sync the Redis proxies with upstream [Doctrine Messenger] Fix support for pgsql + pgbouncer. [Mailer] Simplify fix Do not produce notice/warning when consuming from multiple transports and explicitly listed queues [FrameworkBundle] Check if the _route attribute exists on the request [Scheduler] fix documentation link [PropertyAccess] Fixes getValue() on an unitialized object property on a lazy ghost [HttpClient] Make retry strategy work again AssetMapper: Remove 'auto-generated' info [Mailer] Fix signed emails breaking the profiler [Mailer] [Mailgun] Fix expecting payload without tags or user variables [Validator] Update Spanish (es) translations Fix fetching data in `W3CReferenceTest` on AppVeyor Fix SQS visibility_timeout type [VarDumper] Fix serialization of stubs with null or uninitialized values
2 parents ac77ba6 + 32d67d3 commit c290fc0

File tree

46 files changed

+788
-79
lines changed

Some content is hidden

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

46 files changed

+788
-79
lines changed

.github/workflows/integration-tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ jobs:
140140
sudo service redis-server restart
141141
echo "::endgroup::"
142142
143+
- name: Install pgbouncer
144+
run: |
145+
sudo apt-get install -y pgbouncer
146+
sudo cp src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Fixtures/pgbouncer/pgbouncer.ini /etc/pgbouncer/pgbouncer.ini
147+
sudo cp src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Fixtures/pgbouncer/userlist.txt /etc/pgbouncer/userlist.txt
148+
sudo service pgbouncer restart
149+
sudo su - postgres -c "PGPASSWORD=password psql -Atq -h localhost -p 5432 -U postgres -d postgres -c \"SELECT usename, passwd FROM pg_shadow\""
150+
143151
- name: Configure Couchbase
144152
run: |
145153
curl -s -u 'username=Administrator&password=111111' -X POST http://localhost:8091/node/controller/setupServices -d 'services=kv%2Cn1ql%2Cindex%2Cfts'
@@ -196,6 +204,7 @@ jobs:
196204
MESSENGER_SQS_FIFO_QUEUE_DSN: "sqs://localhost:4566/messages.fifo?sslmode=disable&poll_timeout=0.01"
197205
KAFKA_BROKER: 127.0.0.1:9092
198206
POSTGRES_HOST: localhost
207+
PGBOUNCER_HOST: localhost:6432
199208

200209
#- name: Run HTTP push tests
201210
# if: matrix.php == '8.2'

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"ext-xml": "*",
4040
"doctrine/event-manager": "^2",
4141
"doctrine/persistence": "^3.1",
42-
"twig/twig": "~3.8.0",
42+
"twig/twig": "^3.0.4",
4343
"psr/cache": "^2.0|^3.0",
4444
"psr/clock": "^1.0",
4545
"psr/container": "^1.1|^2.0",

src/Symfony/Bridge/Twig/Node/DumpNode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\YieldReady;
1415
use Twig\Compiler;
1516
use Twig\Node\Node;
1617

1718
/**
1819
* @author Julien Galenski <julien.galenski@gmail.com>
1920
*/
21+
#[YieldReady]
2022
final class DumpNode extends Node
2123
{
2224
private string $varPrefix;

src/Symfony/Bridge/Twig/Node/FormThemeNode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
namespace Symfony\Bridge\Twig\Node;
1313

1414
use Symfony\Component\Form\FormRenderer;
15+
use Twig\Attribute\YieldReady;
1516
use Twig\Compiler;
1617
use Twig\Node\Node;
1718

1819
/**
1920
* @author Fabien Potencier <fabien@symfony.com>
2021
*/
22+
#[YieldReady]
2123
final class FormThemeNode extends Node
2224
{
2325
public function __construct(Node $form, Node $resources, int $lineno, ?string $tag = null, bool $only = false)

src/Symfony/Bridge/Twig/Node/StopwatchNode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\YieldReady;
1415
use Twig\Compiler;
1516
use Twig\Node\Expression\AssignNameExpression;
1617
use Twig\Node\Node;
@@ -20,6 +21,7 @@
2021
*
2122
* @author Wouter J <wouter@wouterj.nl>
2223
*/
24+
#[YieldReady]
2325
final class StopwatchNode extends Node
2426
{
2527
public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, ?string $tag = null)

src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\YieldReady;
1415
use Twig\Compiler;
1516
use Twig\Node\Expression\AbstractExpression;
1617
use Twig\Node\Node;
1718

1819
/**
1920
* @author Fabien Potencier <fabien@symfony.com>
2021
*/
22+
#[YieldReady]
2123
final class TransDefaultDomainNode extends Node
2224
{
2325
public function __construct(AbstractExpression $expr, int $lineno = 0, ?string $tag = null)

src/Symfony/Bridge/Twig/Node/TransNode.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\YieldReady;
1415
use Twig\Compiler;
1516
use Twig\Node\Expression\AbstractExpression;
1617
use Twig\Node\Expression\ArrayExpression;
@@ -22,6 +23,7 @@
2223
/**
2324
* @author Fabien Potencier <fabien@symfony.com>
2425
*/
26+
#[YieldReady]
2527
final class TransNode extends Node
2628
{
2729
public function __construct(Node $body, ?Node $domain = null, ?AbstractExpression $count = null, ?AbstractExpression $vars = null, ?AbstractExpression $locale = null, int $lineno = 0, ?string $tag = null)
@@ -53,9 +55,10 @@ public function compile(Compiler $compiler): void
5355
$vars = null;
5456
}
5557
[$msg, $defaults] = $this->compileString($this->getNode('body'), $defaults, (bool) $vars);
58+
$display = class_exists(YieldReady::class) ? 'yield' : 'echo';
5659

5760
$compiler
58-
->write('echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(')
61+
->write($display.' $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(')
5962
->subcompile($msg)
6063
;
6164

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@
269269
{% endif %}
270270
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
271271
{{ widget|raw }}
272-
{{ translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain) }}
272+
{%- if label is not same as(false) -%}
273+
{{- block('form_label_content') -}}
274+
{%- endif -%}
273275
</label>
274276
{%- endblock checkbox_radio_label %}
275277

src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\Twig\Node\TransNode;
16+
use Twig\Attribute\YieldReady;
1617
use Twig\Compiler;
1718
use Twig\Environment;
1819
use Twig\Loader\LoaderInterface;
@@ -35,7 +36,8 @@ public function testCompileStrict()
3536

3637
$this->assertEquals(
3738
sprintf(
38-
'echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans("trans %%var%%", array_merge(["%%var%%" => %s], %s), "messages");',
39+
'%s $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans("trans %%var%%", array_merge(["%%var%%" => %s], %s), "messages");',
40+
class_exists(YieldReady::class) ? 'yield' : 'echo',
3941
$this->getVariableGetterWithoutStrictCheck('var'),
4042
$this->getVariableGetterWithStrictCheck('foo')
4143
),

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=8.2",
2020
"symfony/translation-contracts": "^2.5|^3",
21-
"twig/twig": "~3.8.0"
21+
"twig/twig": "^3.0.4"
2222
},
2323
"require-dev": {
2424
"egulias/email-validator": "^2.1.10|^3|^4",

src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function guessRoute(Request $request, mixed $controller): string
2828
$controller = $controller[0];
2929
}
3030

31-
if ($controller instanceof RedirectController) {
31+
if ($controller instanceof RedirectController && $request->attributes->has('_route')) {
3232
return $request->attributes->get('_route');
3333
}
3434

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Tests\DataCollector;
13+
14+
use Symfony\Bundle\FrameworkBundle\Controller\RedirectController;
15+
use Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector;
16+
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
17+
use Symfony\Component\HttpFoundation\RedirectResponse;
18+
use Symfony\Component\HttpFoundation\Request;
19+
use Symfony\Component\HttpKernel\Event\ControllerEvent;
20+
use Symfony\Component\HttpKernel\KernelInterface;
21+
22+
class RouterDataCollectorTest extends TestCase
23+
{
24+
public function testRouteRedirectControllerNoRouteAtrribute()
25+
{
26+
$collector = new RouterDataCollector();
27+
28+
$request = Request::create('http://test.com/foo?bar=baz');
29+
$response = new RedirectResponse('http://test.com/redirect');
30+
31+
$event = $this->createControllerEvent($request);
32+
33+
$collector->onKernelController($event);
34+
$collector->collect($request, $response);
35+
36+
$this->assertTrue($collector->getRedirect());
37+
$this->assertEquals('http://test.com/redirect', $collector->getTargetUrl());
38+
$this->assertEquals('n/a', $collector->getTargetRoute());
39+
}
40+
41+
public function testRouteRedirectControllerWithRouteAttribute()
42+
{
43+
$collector = new RouterDataCollector();
44+
45+
$request = Request::create('http://test.com/foo?bar=baz');
46+
$request->attributes->set('_route', 'current-route');
47+
48+
$response = new RedirectResponse('http://test.com/redirect');
49+
50+
$event = $this->createControllerEvent($request);
51+
52+
$collector->onKernelController($event);
53+
$collector->collect($request, $response);
54+
55+
$this->assertTrue($collector->getRedirect());
56+
$this->assertEquals('http://test.com/redirect', $collector->getTargetUrl());
57+
$this->assertEquals('current-route', $collector->getTargetRoute());
58+
}
59+
60+
protected function createControllerEvent(Request $request): ControllerEvent
61+
{
62+
$kernel = $this->createMock(KernelInterface::class);
63+
64+
return new ControllerEvent($kernel, new RedirectController(), $request, null);
65+
}
66+
}

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"symfony/uid": "^6.4|^7.0",
7272
"symfony/web-link": "^6.4|^7.0",
7373
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
74-
"twig/twig": "~3.8.0"
74+
"twig/twig": "^3.0.4"
7575
},
7676
"conflict": {
7777
"doctrine/persistence": "<1.3",

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"symfony/twig-bridge": "^6.4|^7.0",
5151
"symfony/validator": "^6.4|^7.0",
5252
"symfony/yaml": "^6.4|^7.0",
53-
"twig/twig": "~3.8.0",
53+
"twig/twig": "^3.0.4",
5454
"web-token/jwt-checker": "^3.1",
5555
"web-token/jwt-signature-algorithm-hmac": "^3.1",
5656
"web-token/jwt-signature-algorithm-ecdsa": "^3.1",

src/Symfony/Bundle/TwigBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"symfony/twig-bridge": "^6.4|^7.0",
2424
"symfony/http-foundation": "^6.4|^7.0",
2525
"symfony/http-kernel": "^6.4|^7.0",
26-
"twig/twig": "~3.8.0"
26+
"twig/twig": "^3.0.4"
2727
},
2828
"require-dev": {
2929
"symfony/asset": "^6.4|^7.0",

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

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,24 @@
278278
{% for event in collector.events.events(transport) %}
279279
<tr class="mailer-email-summary-table-row {{ loop.first ? 'active' }}" data-target="#email-{{ loop.index }}">
280280
<td>{{ loop.index }}</td>
281-
<td>{{ event.message.getSubject() ?? '(No subject)' }}</td>
282-
<td>{{ event.message.getTo()|map(addr => addr.toString())|join(', ')|default('(empty)') }}</td>
281+
<td>
282+
{% if event.message.subject is defined %}
283+
{{ event.message.getSubject() ?? '(No subject)' }}
284+
{% elseif event.message.headers.has('subject') %}
285+
{{ event.message.headers.get('subject').bodyAsString()|default('(No subject)') }}
286+
{% else %}
287+
(No subject)
288+
{% endif %}
289+
</td>
290+
<td>
291+
{% if event.message.to is defined %}
292+
{{ event.message.getTo()|map(addr => addr.toString())|join(', ')|default('(empty)') }}
293+
{% elseif event.message.headers.has('to') %}
294+
{{ event.message.headers.get('to').bodyAsString()|default('(empty)') }}
295+
{% else %}
296+
(empty)
297+
{% endif %}
298+
</td>
283299
<td < 10000 span class="pl-e">class="visually-hidden"><button class="mailer-email-summary-table-row-button" data-target="#email-{{ loop.index }}">View email details</button></td>
284300
</tr>
285301
{% endfor %}
@@ -323,18 +339,42 @@
323339
<div class="tab-content">
324340
<div class="card-block">
325341
<p class="mailer-message-subject">
326-
{{ message.getSubject() ?? '(No subject)' }}
342+
{% if message.subject is defined %}
343+
{{ message.getSubject() ?? '(No subject)' }}
344+
{% elseif message.headers.has('subject') %}
345+
{{ message.headers.get('subject').bodyAsString()|default('(No subject)') }}
346+
{% else %}
347+
(No subject)
348+
{% endif %}
327349
</p>
328350
<div class="mailer-message-headers">
329-
<p><strong>From:</strong> {{ message.getFrom()|map(addr => addr.toString())|join(', ')|default('(empty)') }}</p>
330-
<p><strong>To:</strong> {{ message.getTo()|map(addr => addr.toString())|join(', ')|default('(empty)') }}</p>
351+
<p>
352+
<strong>From:</strong>
353+
{% if message.from is defined %}
354+
{{ message.getFrom()|map(addr => addr.toString())|join(', ')|default('(empty)') }}
355+
{% elseif message.headers.has('from') %}
356+
{{ message.headers.get('from').bodyAsString()|default('(empty)') }}
357+
{% else %}
358+
(empty)
359+
{% endif %}
360+
</p>
361+
<p>
362+
<strong>To:</strong>
363+
{% if message.to is defined %}
364+
{{ message.getTo()|map(addr => addr.toString())|join(', ')|default('(empty)') }}
365+
{% elseif message.headers.has('to') %}
366+
{{ message.headers.get('to').bodyAsString()|default('(empty)') }}
367+
{% else %}
368+
(empty)
369+
{% endif %}
370+
</p>
331371
{% for header in message.headers.all|filter(header => (header.name ?? '')|lower not in ['subject', 'from', 'to']) %}
332372
<p class="mailer-message-header-secondary">{{ header.toString }}</p>
333373
{% endfor %}
334374
</div>
335375
</div>
336376

337-
{% if message.attachments %}
377+
{% if message.attachments is defined and message.attachments %}
338378
<div class="card-block">
339379
{% set num_of_attachments = message.attachments|length %}
340380
{% set total_attachments_size_in_bytes = message.attachments|reduce((total_size, attachment) => total_size + attachment.body|length, 0) %}
@@ -364,9 +404,10 @@
364404
{% endif %}
365405

366406
<div class="card-block">
367-
{% set textBody = message.textBody %}
368-
{% set htmlBody = message.htmlBody %}
369407
<div class="sf-tabs sf-tabs-sm">
408+
{% if message.htmlBody is defined %}
409+
{% set textBody = message.textBody %}
410+
{% set htmlBody = message.htmlBody %}
370411
<div class="tab {{ not textBody ? 'disabled' }} {{ textBody ? 'active' }}">
371412
<h3 class="tab-title">Text content</h3>
372413
<div class="tab-content">
@@ -414,6 +455,23 @@
414455
{% endif %}
415456
</div>
416457
</div>
458+
{% else %}
459+
{% set body = message.body ? message.body.toString() : null %}
460+
<div class="tab {{ not body ? 'disabled' }} {{ body ? 'active' }}">
461+
<h3 class="tab-title">Content</h3>
462+
<div class="tab-content">
463+
{% if body %}
464+
<pre class="mailer-email-body prewrap" style="max-height: 600px">
465+
{{- body }}
466+
</pre>
467+
{% else %}
468+
<div class="mailer-empty-email-body">
469+
<p>The body is empty.</p>
470+
</div>
471+
{% endif %}
472+
</div>
473+
</div>
474+
{% endif %}
417475
</div>
418476
</div>
419477
</div>

src/Symfony/Bundle/WebProfilerBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"symfony/http-kernel": "^6.4|^7.0",
2323
"symfony/routing": "^6.4|^7.0",
2424
"symfony/twig-bundle": "^6.4|^7.0",
25-
"twig/twig": "~3.8.0"
25+
"twig/twig": "^3.0.4"
2626
},
2727
"require-dev": {
2828
"symfony/browser-kit": "^6.4|^7.0",

src/Symfony/Component/AssetMapper/ImportMap/ImportMapConfigReader.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ public function writeEntries(ImportMapEntries $entries): void
114114
* be used as an "entrypoint" (and passed to the importmap() Twig function).
115115
*
116116
* The "importmap:require" command can be used to add new entries to this file.
117-
*
118-
* This file has been auto-generated by the importmap commands.
119117
*/
120118
return $map;
121119

0 commit comments

Comments
 (0)
0