Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4dde161

Browse filesBrowse files
committed
Merge branch '6.1' into 6.2
* 6.1: do not accept array input when a form is not multiple Update PR template [FrameworkBundle] fix tests Fix merge [Mime] Throw exception when body in Email attach method is not ok [VarDumper][VarExporter] Deal with DatePeriod->include_end_date on PHP 8.2 [Cache] Throw when "redis_sentinel" is used with a non-Predis "class" option New bundle path convention when AbstractBundle is used fix merge Bootstrap 4 fieldset for row errors [Form] Fix same choice loader with different choice values [Filesystem] Safeguard (sym)link calls Fix dumping extension config without bundle [HttpClient] Honor "max_duration" when replacing requests with async decorators [FrameworkBundle] Simplify registration of #[AsRoutingConditionService] [HttpClient] Add missing HttpOptions::setMaxDuration() [HttpKernel] Fix missing null type in `ErrorListener::__construct()` [HttpFoundation] [Session] Overwrite invalid session id
2 parents d8b342e + 955078e commit 4dde161
Copy full SHA for 4dde161

Some content is hidden

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

43 files changed

+385
-82
lines changed

‎.github/PULL_REQUEST_TEMPLATE.md

Copy file name to clipboardExpand all lines: .github/PULL_REQUEST_TEMPLATE.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
| Q | A
22
| ------------- | ---
3-
| Branch? | 6.1 for features / 4.4, 5.4 or 6.0 for bug fixes <!-- see below -->
3+
| Branch? | 6.2 for features / 4.4, 5.4, 6.0 or 6.1 for bug fixes <!-- see below -->
44
| Bug fix? | yes/no
55
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
66
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->

‎src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ public function testLoadChoiceListUsesObjectLoaderIfAvailable()
153153
$this->assertEquals($choiceList, $loaded = $loader->loadChoiceList());
154154

155155
// no further loads on subsequent calls
156-
157-
$this->assertSame($loaded, $loader->loadChoiceList());
156+
$this->assertEquals($loaded, $loader->loadChoiceList());
158157
}
159158

160159
public function testLoadValuesForChoices()

‎src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,4 +1776,32 @@ public function testSubmitNullMultipleUsesDefaultEmptyData()
17761776
$this->assertEquals($collection, $form->getNormData());
17771777
$this->assertEquals($collection, $form->getData());
17781778
}
1779+
1780+
public function testWithSameLoaderAndDifferentChoiceValueCallbacks()
1781+
{
1782+
$entity1 = new SingleIntIdEntity(1, 'Foo');
1783+
$entity2 = new SingleIntIdEntity(2, 'Bar');
1784+
$this->persist([$entity1, $entity2]);
1785+
1786+
$view = $this->factory->create(FormTypeTest::TESTED_TYPE)
1787+
->add('entity_one', self::TESTED_TYPE, [
1788+
'em' => 'default',
1789+
'class' => self::SINGLE_IDENT_CLASS,
1790+
])
1791+
->add('entity_two', self::TESTED_TYPE, [
1792+
'em' => 'default',
1793+
'class' => self::SINGLE_IDENT_CLASS,
1794+
'choice_value' => function ($choice) {
1795+
return $choice ? $choice->name : '';
1796+
},
1797+
])
1798+
->createView()
1799+
;
1800+
1801+
$this->assertSame('1', $view['entity_one']->vars['choices'][1]->value);
1802+
$this->assertSame('2', $view['entity_one']->vars['choices'][2]->value);
1803+
1804+
$this->assertSame('Foo', $view['entity_two']->vars['choices']['Foo']->value);
1805+
$this->assertSame('Bar', $view['entity_two']->vars['choices']['Bar']->value);
1806+
}
17791807
}

‎src/Symfony/Bridge/Doctrine/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"symfony/cache": "^5.4|^6.0",
3030
"symfony/config": "^5.4|^6.0",
3131
"symfony/dependency-injection": "^5.4|^6.0",
32-
"symfony/form": "^5.4|^6.0",
32+
"symfony/form": "^5.4.9|^6.0.9",
3333
"symfony/http-kernel": "^5.4|^6.0",
3434
"symfony/messenger": "^5.4|^6.0",
3535
"symfony/doctrine-messenger": "^5.4|^6.0",

‎src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ col-sm-2
4949
<div class="{{ block('form_group_class') }}">
5050
{{- form_widget(form, widget_attr) -}}
5151
{{- form_help(form) -}}
52+
{{- form_errors(form) -}}
5253
</div>
5354
</div>
5455
{##}</fieldset>

‎src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php
+11-12Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Console\Helper\Table;
1717
use Symfony\Component\Console\Output\OutputInterface;
1818
use Symfony\Component\Console\Style\StyleInterface;
19+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1920
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
2021
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
2122

@@ -54,7 +55,7 @@ protected function listBundles(OutputInterface|StyleInterface $output)
5455
}
5556
}
5657

57-
protected function findExtension(string $name): ExtensionInterface
58+
protected function findExtension(string $name, ContainerBuilder $container): ExtensionInterface
5859
{
5960
$bundles = $this->initializeBundles();
6061
$minScore = \INF;
@@ -90,20 +91,18 @@ protected function findExtension(string $name): ExtensionInterface
9091
$guess = $bundle->getName();
9192
$minScore = $distance;
9293
}
94+
}
9395

94-
$extension = $bundle->getContainerExtension();
95-
96-
if ($extension) {
97-
if ($name === $extension->getAlias()) {
98-
return $extension;
99-
}
96+
if ($container->hasExtension($name)) {
97+
return $container->getExtension($name);
98+
}
10099

101-
$distance = levenshtein($name, $extension->getAlias());
100+
foreach ($container->getExtensions() as $extension) {
101+
$distance = levenshtein($name, $extension->getAlias());
102102

103-
if ($distance < $minScore) {
104-
$guess = $extension->getAlias();
105-
$minScore = $distance;
106-
}
103+
if ($distance < $minScore) {
104+
$guess = $extension->getAlias();
105+
$minScore = $distance;
107106
}
108107
}
109108

‎src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9090
return 0;
9191
}
9292

93-
$extension = $this->findExtension($name);
94-
$extensionAlias = $extension->getAlias();
9593
$container = $this->compileContainer();
94+
$extension = $this->findExtension($name, $container);
95+
$extensionAlias = $extension->getAlias();
9696

9797
$config = $this->getConfig($extension, $container);
9898

@@ -192,7 +192,8 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
192192

193193
if ($input->mustSuggestArgumentValuesFor('path') && null !== $name = $input->getArgument('name')) {
194194
try {
195-
$config = $this->getConfig($this->findExtension($name), $this->compileContainer());
195+
$container = $this->compileContainer();
196+
$config = $this->getConfig($this->findExtension($name, $container), $container);
196197
$paths = array_keys(self::buildPathsCompletion($config));
197198
$suggestions->suggestValues($paths);
198199
} catch (LogicException) {

‎src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
103103
return 0;
104104
}
105105

106-
$extension = $this->findExtension($name);
106+
$container = $this->getContainerBuilder($this->getApplication()->getKernel());
107+
$extension = $this->findExtension($name, $container);
107108

108109
if ($extension instanceof ConfigurationInterface) {
109110
$configuration = $extension;
110111
} else {
111-
$configuration = $extension->getConfiguration([], $this->getContainerBuilder($this->getApplication()->getKernel()));
112+
$configuration = $extension->getConfiguration([], $container);
112113
}
113114

114115
$this->validateConfiguration($extension, $configuration);

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Symfony\Bridge\Twig\Extension\CsrfExtension;
2828
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2929
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
30-
use Symfony\Bundle\FrameworkBundle\Routing\Attribute\AsRoutingConditionService;
3130
use Symfony\Bundle\FrameworkBundle\Routing\RouteLoaderInterface;
3231
use Symfony\Bundle\FullStack;
3332
use Symfony\Bundle\MercureBundle\MercureBundle;
@@ -683,10 +682,6 @@ public function load(array $configs, ContainerBuilder $container)
683682
'kernel.locale_aware',
684683
'kernel.reset',
685684
]);
686-
687-
$container->registerAttributeForAutoconfiguration(AsRoutingConditionService::class, static function (ChildDefinition $definition, AsRoutingConditionService $attribute): void {
688-
$definition->addTag('routing.condition_service', (array) $attribute);
689-
});
690685
}
691686

692687
/**

‎src/Symfony/Bundle/FrameworkBundle/Routing/Attribute/AsRoutingConditionService.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Routing/Attribute/AsRoutingConditionService.php
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Routing\Attribute;
1313

14+
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
15+
1416
/**
1517
* Service tag to autoconfigure routing condition services.
1618
*
@@ -37,11 +39,12 @@
3739
* }
3840
*/
3941
#[\Attribute(\Attribute::TARGET_CLASS)]
40-
class AsRoutingConditionService
42+
class AsRoutingConditionService extends AutoconfigureTag
4143
{
4244
public function __construct(
43-
public ?string $alias = null,
44-
public int $priority = 0,
45+
string $alias = null,
46+
int $priority = 0,
4547
) {
48+
parent::__construct('routing.condition_service', ['alias' => $alias, 'priority' => $priority]);
4649
}
4750
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ public function testDefaultParameterValueIsResolvedIfConfigIsExisting()
7070
$this->assertStringContainsString(sprintf("dsn: 'file:%s/profiler'", $kernelCacheDir), $tester->getDisplay());
7171
}
7272

73+
public function testDumpExtensionConfigWithoutBundle()
74+
{
75+
$tester = $this->createCommandTester();
76+
$ret = $tester->execute(['name' => 'test_dump']);
77+
78+
$this->assertSame(0, $ret, 'Returns 0 in case of success');
79+
$this->assertStringContainsString('enabled: true', $tester->getDisplay());
80+
}
81+
7382
public function testDumpUndefinedBundleOption()
7483
{
7584
$tester = $this->createCommandTester();

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ public function testDumpBundleName()
5050
$this->assertStringContainsString(' custom:', $tester->getDisplay());
5151
}
5252

53+
public function testDumpExtensionConfigWithoutBundle()
54+
{
55+
$tester = $this->createCommandTester();
56+
$ret = $tester->execute(['name' => 'test_dump']);
57+
58+
$this->assertSame(0, $ret, 'Returns 0 in case of success');
59+
$this->assertStringContainsString('enabled: true', $tester->getDisplay());
60+
}
61+
5362
public function testDumpAtPath()
5463
{
5564
$tester = $this->createCommandTester();
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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\Functional\Extension;
13+
14+
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15+
use Symfony\Component\Config\Definition\ConfigurationInterface;
16+
use Symfony\Component\DependencyInjection\ContainerBuilder;
17+
use Symfony\Component\DependencyInjection\Extension\Extension;
18+
19+
class TestDumpExtension extends Extension implements ConfigurationInterface
20+
{
21+
public function getConfigTreeBuilder(): TreeBuilder
22+
{
23+
$treeBuilder = new TreeBuilder('test_dump');
24+
$treeBuilder->getRootNode()
25+
->children()
26+
->booleanNode('enabled')->defaultTrue()->end()
27+
->end()
28+
;
29+
30+
return $treeBuilder;
31+
}
32+
33+
public function load(array $configs, ContainerBuilder $container): void
34+
{
35+
}
36+
37+
public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface
38+
{
39+
return $this;
40+
}
41+
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\app;
1313

1414
use Psr\Log\NullLogger;
15+
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Extension\TestDumpExtension;
1516
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1617
use Symfony\Component\Config\Definition\ConfigurationInterface;
1718
use Symfony\Component\Config\Loader\LoaderInterface;
@@ -80,6 +81,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
8081
protected function build(ContainerBuilder $container)
8182
{
8283
$container->register('logger', NullLogger::class);
84+
$container->registerExtension(new TestDumpExtension());
8385
}
8486

8587
public function __sleep(): array

‎src/Symfony/Bundle/FrameworkBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/composer.json
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
"composer-runtime-api": ">=2.1",
2121
"ext-xml": "*",
2222
"symfony/cache": "^5.4|^6.0",
23-
"symfony/config": "^5.4|^6.0",
24-
"symfony/dependency-injection": "^5.4.5|^6.0.5",
23+
"symfony/config": "^6.1",
24+
"symfony/dependency-injection": "^6.1",
2525
"symfony/deprecation-contracts": "^2.1|^3",
26+
"symfony/error-handler": "^6.1",
2627
"symfony/event-dispatcher": "^5.4|^6.0",
27-
"symfony/error-handler": "^5.4|^6.0",
2828
"symfony/http-foundation": "^5.4|^6.0",
2929
"symfony/http-kernel": "^6.1",
3030
"symfony/polyfill-mbstring": "~1.0",
@@ -55,7 +55,7 @@
5555
"symfony/rate-limiter": "^5.4|^6.0",
5656
"symfony/security-bundle": "^5.4|^6.0",
5757
"symfony/semaphore": "^5.4|^6.0",
58-
"symfony/serializer": "^5.4|^6.0",
58+
"symfony/serializer": "^6.1",
5959
"symfony/stopwatch": "^5.4|^6.0",
6060
"symfony/string": "^5.4|^6.0",
6161
"symfony/translation": "^5.4|^6.0",

‎src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterSentinelTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterSentinelTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\SkippedTestSuiteError;
1515
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1616
use Symfony\Component\Cache\Adapter\RedisAdapter;
17+
use Symfony\Component\Cache\Exception\CacheException;
1718
use Symfony\Component\Cache\Exception\InvalidArgumentException;
1819

1920
/**

‎src/Symfony/Component/Cache/Traits/RedisTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ public static function createConnection(string $dsn, array $options = []): \Redi
177177
$class = $params['redis_cluster'] ? \RedisCluster::class : (1 < \count($hosts) ? \RedisArray::class : \Redis::class);
178178
} else {
179179
$class = $params['class'] ?? \Predis\Client::class;
180+
181+
if (isset($params['redis_sentinel']) && !is_a($class, \Predis\Client::class, true) && !class_exists(\RedisSentinel::class)) {
182+
throw new CacheException(sprintf('Cannot use Redis Sentinel: class "%s" does not extend "Predis\Client" and ext-redis >= 5.2 not found: "%s".', $class, $dsn));
183+
}
180184
}
181185

182186
if (is_a($class, \Redis::class, true)) {

‎src/Symfony/Component/Filesystem/Filesystem.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Filesystem.php
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ private function isReadable(string $filename): bool
317317
*/
318318
public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false)
319319
{
320+
self::assertFunctionExists('symlink');
321+
320322
if ('\\' === \DIRECTORY_SEPARATOR) {
321323
$originDir = strtr($originDir, '/', '\\');
322324
$targetDir = strtr($targetDir, '/', '\\');
@@ -352,6 +354,8 @@ public function symlink(string $originDir, string $targetDir, bool $copyOnWindow
352354
*/
353355
public function hardlink(string $originFile, string|iterable $targetFiles)
354356
{
357+
self::assertFunctionExists('link');
358+
355359
if (!$this->exists($originFile)) {
356360
throw new FileNotFoundException(null, 0, null, $originFile);
357361
}
@@ -703,8 +707,17 @@ private function getSchemeAndHierarchy(string $filename): array
703707
return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
704708
}
705709

706-
private static function box(callable $func, mixed ...$args): mixed
710+
private static function assertFunctionExists(string $func): void
707711
{
712+
if (!\function_exists($func)) {
713+
throw new IOException(sprintf('Unable to perform filesystem operation because the "%s()" function has been disabled.', $func));
714+
}
715+
}
716+
717+
private static function box(string $func, mixed ...$args): mixed
718+
{
719+
self::assertFunctionExists($func);
720+
708721
self::$lastError = null;
709722
set_error_handler(__CLASS__.'::handleError');
710723
try {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.