Skip to content

Commit f991f32

Browse files
Merge branch '6.4' into 7.0
* 6.4: [FrameworkBundle] Deprecate not setting some options (uid, validation) [Serializer] Fix deps [FrameworkBundle] Deprecate not setting some options
2 parents 9355748 + 06ab255 commit f991f32

File tree

292 files changed

+855
-125
lines changed

Some content is hidden

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

292 files changed

+855
-125
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ CHANGELOG
2626
* Add `DomCrawlerAssertionsTrait::assertAnySelectorTextNotContains(string $selector, string $text)`
2727
* Deprecate `EnableLoggerDebugModePass`, use argument `$debug` of HttpKernel's `Logger` instead
2828
* Deprecate `AddDebugLogProcessorPass::configureLogger()`, use HttpKernel's `DebugLoggerConfigurator` instead
29+
* Deprecate not setting the `framework.handle_all_throwables` config option; it will default to `true` in 7.0
30+
* Deprecate not setting the `framework.php_errors.log` config option; it will default to `true` in 7.0
31+
* Deprecate not setting the `framework.session.cookie_secure` config option; it will default to `auto` in 7.0
32+
* Deprecate not setting the `framework.session.cookie_samesite` config option; it will default to `lax` in 7.0
33+
* Deprecate not setting the `framework.session.handler_id` config option; it will default to `session.handler.native_file` when `framework.session.save_path` is set or `null` otherwise in 7.0
34+
* Deprecate not setting the `framework.uid.default_uuid_version` config option; it will default to `7` in 7.0
35+
* Deprecate not setting the `framework.uid.time_based_uuid_version` config option; it will default to `7` in 7.0
36+
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0
2937

3038
6.3
3139
---

DependencyInjection/Configuration.php

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ public function getConfigTreeBuilder(): TreeBuilder
8282
return $v;
8383
})
8484
->end()
85+
->validate()
86+
->always(function ($v) {
87+
if (!isset($v['handle_all_throwables'])) {
88+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.handle_all_throwables" config option is deprecated. It will default to "true" in 7.0.');
89+
}
90+
91+
return $v;
92+
})
93+
->end()
8594
->fixXmlConfig('enabled_locale')
8695
->children()
8796
->scalarNode('secret')->end()
@@ -640,13 +649,34 @@ private function addRouterSection(ArrayNodeDefinition $rootNode): void
640649
private function addSessionSection(ArrayNodeDefinition $rootNode): void
641650
{
642651
$rootNode
652+
->validate()
653+
->always(function (array $v): array {
654+
if ($v['session']['enabled']) {
655+
if (!\array_key_exists('cookie_secure', $v['session'])) {
656+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.session.cookie_secure" config option is deprecated. It will default to "auto" in 7.0.');
657+
}
658+
659+
if (!\array_key_exists('cookie_samesite', $v['session'])) {
660+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.session.cookie_samesite" config option is deprecated. It will default to "lax" in 7.0.');
661+
}
662+
663+
if (!\array_key_exists('handler_id', $v['session'])) {
664+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.session.handler_id" config option is deprecated. It will default to "session.handler.native_file" when "framework.session.save_path" is set or "null" otherwise in 7.0.');
665+
}
666+
}
667+
668+
$v['session'] += ['cookie_samesite' => null, 'handler_id' => 'session.handler.native_file'];
669+
670+
return $v;
671+
})
672+
->end()
643673
->children()
644674
->arrayNode('session')
645675
->info('session configuration')
646676
->canBeEnabled()
647677
->children()
648678
->scalarNode('storage_factory_id')->defaultValue('session.storage.factory.native')->end()
649-
->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
679+
->scalarNode('handler_id')->end()
650680
->scalarNode('name')
651681
->validate()
652682
->ifTrue(function ($v) {
@@ -662,7 +692,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
662692
->scalarNode('cookie_domain')->end()
663693
->enumNode('cookie_secure')->values([true, false, 'auto'])->end()
664694
->booleanNode('cookie_httponly')->defaultTrue()->end()
665-
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->defaultNull()->end()
695+
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->end()
666696
->booleanNode('use_cookies')->end()
667697
->scalarNode('gc_divisor')->end()
668698
->scalarNode('gc_probability')->defaultValue(1)->end()
@@ -979,6 +1009,15 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
9791009
private function addValidationSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
9801010
{
9811011
$rootNode
1012+
->validate()
1013+
->always(function ($v) {
1014+
if ($v['validation']['enabled'] && !\array_key_exists('email_validation_mode', $v['validation'])) {
1015+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.validation.email_validation_mode" config option is deprecated. It will default to "html5" in 7.0.');
1016+
}
1017+
1018+
return $v;
1019+
})
1020+
->end()
9821021
->children()
9831022
->arrayNode('validation')
9841023
->info('validation configuration')
@@ -1243,6 +1282,17 @@ private function addCacheSection(ArrayNodeDefinition $rootNode, callable $willBe
12431282
private function addPhpErrorsSection(ArrayNodeDefinition $rootNode): void
12441283
{
12451284
$rootNode
1285+
->validate()
1286+
->always(function (array $v): array {
1287+
if (!\array_key_exists('log', $v['php_errors'])) {
1288+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.php_errors.log" config option is deprecated. It will default to "true" in 7.0.');
1289+
1290+
$v['php_errors']['log'] = $this->debug;
1291+
}
1292+
1293+
return $v;
1294+
})
1295+
->end()
12461296
->children()
12471297
->arrayNode('php_errors')
12481298
->info('PHP errors handling configuration')
@@ -1251,7 +1301,6 @@ private function addPhpErrorsSection(ArrayNodeDefinition $rootNode): void
12511301
->variableNode('log')
12521302
->info('Use the application logger instead of the PHP logger for logging PHP errors.')
12531303
->example('"true" to use the default configuration: log all errors. "false" to disable. An integer bit field of E_* constants, or an array mapping E_* constants to log levels.')
1254-
->defaultValue($this->debug)
12551304
->treatNullLike($this->debug)
12561305
->beforeNormalization()
12571306
->ifArray()
@@ -2265,14 +2314,30 @@ private function addRateLimiterSection(ArrayNodeDefinition $rootNode, callable $
22652314
private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
22662315
{
22672316
$rootNode
2317+
->validate()
2318+
->always(function ($v) {
2319+
if ($v['uid']['enabled']) {
2320+
if (!\array_key_exists('default_uuid_version', $v['uid'])) {
2321+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.uid.default_uuid_version" config option is deprecated. It will default to "7" in 7.0.');
2322+
}
2323+
2324+
if (!\array_key_exists('time_based_uuid_version', $v['uid'])) {
2325+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.uid.time_based_uuid_version" config option is deprecated. It will default to "7" in 7.0.');
2326+
}
2327+
}
2328+
2329+
$v['uid'] += ['default_uuid_version' => 6, 'time_based_uuid_version' => 6];
2330+
2331+
return $v;
2332+
})
2333+
->end()
22682334
->children()
22692335
->arrayNode('uid')
22702336
->info('Uid configuration')
22712337
->{$enableIfStandalone('symfony/uid', UuidFactory::class)}()
22722338
->addDefaultsIfNotSet()
22732339
->children()
22742340
->enumNode('default_uuid_version')
2275-
->defaultValue(6)
22762341
->values([7, 6, 4, 1])
22772342
->end()
22782343
->enumNode('name_based_uuid_version')
@@ -2283,7 +2348,6 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
22832348
->cannotBeEmpty()
22842349
->end()
22852350
->enumNode('time_based_uuid_version')
2286-
->defaultValue(6)
22872351
->values([7, 6, 1])
22882352
->end()
22892353
->scalarNode('time_based_uuid_node')

Tests/Command/AboutCommand/Fixture/TestAppKernel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
3636
$container->loadFromExtension('framework', [
3737
'annotations' => false,
3838
'http_method_override' => false,
39+
'handle_all_throwables' => true,
40+
'php_errors' => ['log' => true],
3941
]);
4042
});
4143
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
framework:
22
annotations: false
33
http_method_override: false
4+
handle_all_throwables: true
5+
php_errors:
6+
log: true
47
secret: test

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ class ConfigurationTest extends TestCase
3535
public function testDefaultConfig()
3636
{
3737
$processor = new Processor();
38-
$config = $processor->processConfiguration(new Configuration(true), [['http_method_override' => false, 'secret' => 's3cr3t', 'serializer' => ['default_context' => ['foo' => 'bar']]]]);
38+
$config = $processor->processConfiguration(new Configuration(true), [[
39+
'http_method_override' => false,
40+
'handle_all_throwables' => true,
41+
'php_errors' => ['log' => true],
42+
'secret' => 's3cr3t',
43+
'serializer' => ['default_context' => ['foo' => 'bar']],
44+
]]);
3945

4046
$this->assertEquals(self::getBundleDefaultConfig(), $config);
4147
}
@@ -59,7 +65,12 @@ public function testInvalidSessionName($sessionName)
5965
$processor = new Processor();
6066
$processor->processConfiguration(
6167
new Configuration(true),
62-
[['http_method_override' => false, 'session' => ['name' => $sessionName]]]
68+
[[
69+
'http_method_override' => false,
70+
'handle_all_throwables' => true,
71+
'php_errors' => ['log' => true],
72+
'session' => ['name' => $sessionName, 'cookie_secure' => 'auto', 'cookie_samesite' => 'lax'],
73+
]]
6374
);
6475
}
6576

@@ -79,7 +90,12 @@ public function testAssetsCanBeEnabled()
7990
{
8091
$processor = new Processor();
8192
$configuration = new Configuration(true);
82-
$config = $processor->processConfiguration($configuration, [['http_method_override' => false, 'assets' => null]]);
93+
$config = $processor->processConfiguration($configuration, [[
94+
'http_method_override' => false,
95+
'handle_all_throwables' => true,
96+
'php_errors' => ['log' => true],
97+
'assets' => null,
98+
]]);
8399

84100
$defaultConfig = [
85101
'enabled' => true,
@@ -100,7 +116,12 @@ public function testAssetMapperCanBeEnabled()
100116
{
101117
$processor = new Processor();
102118
$configuration = new Configuration(true);
103-
$config = $processor->processConfiguration($configuration, [['http_method_override' => false, 'asset_mapper' => null]]);
119+
$config = $processor->processConfiguration($configuration, [[
120+
'http_method_override' => false,
121+
'handle_all_throwables' => true,
122+
'php_errors' => ['log' => true],
123+
'asset_mapper' => null,
124+
]]);
104125

105126
$defaultConfig = [
106127
'enabled' => true,
@@ -130,6 +151,8 @@ public function testValidAssetsPackageNameConfiguration($packageName)
130151
$config = $processor->processConfiguration($configuration, [
131152
[
132153
'http_method_override' => false,
154+
'handle_all_throwables' => true,
155+
'php_errors' => ['log' => true],
133156
'assets' => [
134157
'packages' => [
135158
$packageName => [],
@@ -163,6 +186,8 @@ public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMess
163186
$processor->processConfiguration($configuration, [
164187
[
165188
'http_method_override' => false,
189+
'handle_all_throwables' => true,
190+
'php_errors' => ['log' => true],
166191
'assets' => $assetConfig,
167192
],
168193
]);
@@ -211,6 +236,8 @@ public function testValidLockConfiguration($lockConfig, $processedConfig)
211236
$config = $processor->processConfiguration($configuration, [
212237
[
213238
'http_method_override' => false,
239+
'handle_all_throwables' => true,
240+
'php_errors' => ['log' => true],
214241
'lock' => $lockConfig,
215242
],
216243
]);
@@ -272,12 +299,16 @@ public function testLockMergeConfigs()
272299
$config = $processor->processConfiguration($configuration, [
273300
[
274301
'http_method_override' => false,
302+
'handle_all_throwables' => true,
303+
'php_errors' => ['log' => true],
275304
'lock' => [
276305
'payload' => 'flock',
277306
],
278307
],
279308
[
280309
'http_method_override' => false,
310+
'handle_all_throwables' => true,
311+
'php_errors' => ['log' => true],
281312
'lock' => [
282313
'payload' => 'semaphore',
283314
],
@@ -305,6 +336,8 @@ public function testValidSemaphoreConfiguration($semaphoreConfig, $processedConf
305336
$config = $processor->processConfiguration($configuration, [
306337
[
307338
'http_method_override' => false,
339+
'handle_all_throwables' => true,
340+
'php_errors' => ['log' => true],
308341
'semaphore' => $semaphoreConfig,
309342
],
310343
]);
@@ -358,6 +391,8 @@ public function testItShowANiceMessageIfTwoMessengerBusesAreConfiguredButNoDefau
358391
$processor->processConfiguration($configuration, [
359392
'framework' => [
360393
'http_method_override' => false,
394+
'handle_all_throwables' => true,
395+
'php_errors' => ['log' => true],
361396
'messenger' => [
362397
'default_bus' => null,
363398
'buses' => [
@@ -376,6 +411,8 @@ public function testBusMiddlewareDontMerge()
376411
$config = $processor->processConfiguration($configuration, [
377412
[
378413
'http_method_override' => false,
414+
'handle_all_throwables' => true,
415+
'php_errors' => ['log' => true],
379416
'messenger' => [
380417
'default_bus' => 'existing_bus',
381418
'buses' => [
@@ -391,6 +428,8 @@ public function testBusMiddlewareDontMerge()
391428
],
392429
[
393430
'http_method_override' => false,
431+
'handle_all_throwables' => true,
432+
'php_errors' => ['log' => true],
394433
'messenger' => [
395434
'buses' => [
396435
'common_bus' => [
@@ -440,6 +479,8 @@ public function testItErrorsWhenDefaultBusDoesNotExist()
440479
$processor->processConfiguration($configuration, [
441480
[
442481
'http_method_override' => false,
482+
'handle_all_throwables' => true,
483+
'php_errors' => ['log' => true],
443484
'messenger' => [
444485
'default_bus' => 'foo',
445486
'buses' => [
@@ -459,6 +500,8 @@ public function testLockCanBeDisabled()
459500
$config = $processor->processConfiguration($configuration, [
460501
[
461502
'http_method_override' => false,
503+
'handle_all_throwables' => true,
504+
'php_errors' => ['log' => true],
462505
'lock' => ['enabled' => false],
463506
],
464507
]);
@@ -477,6 +520,8 @@ public function testEnabledLockNeedsResources()
477520
$processor->processConfiguration($configuration, [
478521
[
479522
'http_method_override' => false,
523+
'handle_all_throwables' => true,
524+
'php_errors' => ['log' => true],
480525
'lock' => ['enabled' => true],
481526
],
482527
]);
@@ -486,6 +531,7 @@ protected static function getBundleDefaultConfig()
486531
{
487532
return [
488533
'http_method_override' => false,
534+
'handle_all_throwables' => true,
489535
'trust_x_sendfile_type_header' => false,
490536
'ide' => '%env(default::SYMFONY_IDE)%',
491537
'default_locale' => 'en',

Tests/DependencyInjection/Fixtures/php/assets.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
$container->loadFromExtension('framework', [
44
'annotations' => false,
55
'http_method_override' => false,
6+
'handle_all_throwables' => true,
7+
'php_errors' => ['log' => true],
68
'assets' => [
79
'version' => 'SomeVersionScheme',
810
'base_urls' => 'http://cdn.example.com',

Tests/DependencyInjection/Fixtures/php/assets_disabled.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
$container->loadFromExtension('framework', [
44
'annotations' => false,
55
'http_method_override' => false,
6+
'handle_all_throwables' => true,
7+
'php_errors' => ['log' => true],
68
'assets' => [
79
'enabled' => false,
810
],

Tests/DependencyInjection/Fixtures/php/assets_version_strategy_as_service.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
$container->loadFromExtension('framework', [
44
'annotations' => false,
55
'http_method_override' => false,
6+
'handle_all_throwables' => true,
7+
'php_errors' => ['log' => true],
68
'assets' => [
79
'version_strategy' => 'assets.custom_version_strategy',
810
'base_urls' => 'http://cdn.example.com',

Tests/DependencyInjection/Fixtures/php/cache.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
$container->loadFromExtension('framework', [
44
'annotations' => false,
55
'http_method_override' => false,
6+
'handle_all_throwables' => true,
7+
'php_errors' => ['log' => true],
68
'cache' => [
79
'pools' => [
810
'cache.foo' => [

Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
$container->loadFromExtension('framework', [
44
'annotations' => false,
55
'http_method_override' => false,
6+
'handle_all_throwables' => true,
7+
'php_errors' => ['log' => true],
68
'cache' => [
79
'app' => 'cache.adapter.redis_tag_aware',
810
],

0 commit comments

Comments
 (0)