Skip to content

Commit c11519a

Browse files
Merge branch '7.2' into 7.3
* 7.2: [Validator] Review Croatian translation [Validator] Review "twig template" translation Update Mailer Azure bridge API docs link Provide missing translations thanks to Gemini [DependencyInjection] Make `DefinitionErrorExceptionPass` consider `IGNORE_ON_UNINITIALIZED_REFERENCE` and `RUNTIME_EXCEPTION_ON_INVALID_REFERENCE` the same [FrameworkBundle] Fix declaring fiel-attr tags in xml config files [WebLink] Hint that prerender is deprecated [DependencyInjection] Fix missing binding for ServiceCollectionInterface when declaring a service subscriber
2 parents 94f4d7a + 1084655 commit c11519a

File tree

66 files changed

+134
-75
lines changed

Some content is hidden

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

66 files changed

+134
-75
lines changed

src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getFunctions(): array
4444
/**
4545
* Adds a "Link" HTTP header.
4646
*
47-
* @param string $rel The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch")
47+
* @param string $rel The relation type (e.g. "preload", "prefetch", or "dns-prefetch")
4848
* @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
4949
*
5050
* @return string The relation URI
@@ -115,7 +115,11 @@ public function prefetch(string $uri, array $attributes = []): string
115115
}
116116

117117
/**
118-
* Indicates to the client that it should prerender this resource .
118+
* Indicates to the client that it should prerender this resource.
119+
*
120+
* This feature is deprecated and superseded by the Speculation Rules API.
121+
*
122+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel/prerender
119123
*
120124
* @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
121125
*

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ private function addFormSection(ArrayNodeDefinition $rootNode, callable $enableI
257257
->arrayNode('field_attr')
258258
->performNoDeepMerging()
259259
->normalizeKeys(false)
260+
->useAttributeAsKey('name')
260261
->scalarPrototype()->end()
261262
->defaultValue(['data-controller' => 'csrf-protection'])
262263
->end()

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<xsd:attribute name="field-name" type="xsd:string" />
8181
</xsd:complexType>
8282

83-
<xsd:complexType name="field_attr">
83+
<xsd:complexType name="field_attr" mixed="true">
8484
<xsd:attribute name="name" type="xsd:string" use="required"/>
8585
</xsd:complexType>
8686

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'annotations' => false,
5+
'http_method_override' => false,
6+
'handle_all_throwables' => true,
7+
'php_errors' => ['log' => true],
8+
'csrf_protection' => [
9+
'enabled' => true,
10+
],
11+
'form' => [
12+
'csrf_protection' => [
13+
'field-attr' => [
14+
'data-foo' => 'bar',
15+
'data-bar' => 'baz',
16+
],
17+
],
18+
],
19+
'session' => [
20+
'storage_factory_id' => 'session.storage.factory.native',
21+
],
22+
]);
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99
<framework:config http-method-override="false" handle-all-throwables="true">
1010
<framework:annotations enabled="false" />
1111
<framework:php-errors log="true" />
12-
<framework:csrf-protection field-name="_custom" />
12+
<framework:csrf-protection enabled="true" />
13+
<framework:form>
14+
<framework:csrf-protection>
15+
<framework:field-attr name="data-foo">bar</framework:field-attr>
16+
<framework:field-attr name="data-bar">baz</framework:field-attr>
17+
</framework:csrf-protection>
18+
</framework:form>
1319
<framework:session storage-factory-id="session.storage.factory.native" />
1420
</framework:config>
1521
</container>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/form_csrf_under_form_sets_field_name.xml

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
framework:
2+
annotations: false
3+
http_method_override: false
4+
handle_all_throwables: true
5+
php_errors:
6+
log: true
7+
csrf_protection:
8+
enabled: true
9+
form:
10+
csrf_protection:
11+
enabled: true
12+
field_attr:
13+
data-foo: bar
14+
data-bar: baz
15+
session:
16+
storage_factory_id: session.storage.factory.native

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,17 @@ public function testFormsCanBeEnabledWithoutCsrfProtection()
14911491
$this->assertFalse($container->getParameter('form.type_extension.csrf.enabled'));
14921492
}
14931493

1494+
public function testFormCsrfFieldAttr()
1495+
{
1496+
$container = $this->createContainerFromFile('form_csrf_field_attr');
1497+
1498+
$expected = [
1499+
'data-foo' => 'bar',
1500+
'data-bar' => 'baz',
1501+
];
1502+
$this->assertSame($expected, $container->getParameter('form.type_extension.csrf.field_attr'));
1503+
}
1504+
14941505
public function testStopwatchEnabledWithDebugModeEnabled()
14951506
{
14961507
$container = $this->createContainerFromFile('default_config', [

src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
6262
}
6363

6464
if ($value instanceof Reference && $this->currentId !== $targetId = (string) $value) {
65-
if (ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
65+
if (
66+
ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()
67+
|| ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior()
68+
) {
6669
$this->sourceReferences[$targetId][$this->currentId] ??= true;
6770
} else {
6871
$this->sourceReferences[$targetId][$this->currentId] = false;

src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\DependencyInjection\Reference;
2121
use Symfony\Component\DependencyInjection\TypedReference;
2222
use Symfony\Contracts\Service\Attribute\SubscribedService;
23+
use Symfony\Contracts\Service\ServiceCollectionInterface;
2324
use Symfony\Contracts\Service\ServiceProviderInterface;
2425
use Symfony\Contracts\Service\ServiceSubscriberInterface;
2526

@@ -134,6 +135,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
134135
$value->setBindings([
135136
PsrContainerInterface::class => new BoundArgument($locatorRef, false),
136137
ServiceProviderInterface::class => new BoundArgument($locatorRef, false),
138+
ServiceCollectionInterface::class => new BoundArgument($locatorRef, false),
137139
] + $value->getBindings());
138140

139141
return parent::processValue($value);

0 commit comments

Comments
 (0)