Skip to content

Commit f9cf24a

Browse files
Tobionfabpot
authored andcommitted
[FrameworkBundle] deprecate not setting http_method_override
1 parent e740a11 commit f9cf24a

File tree

292 files changed

+333
-101
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

+333
-101
lines changed

UPGRADE-6.1.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ FrameworkBundle
2525

2626
* Deprecate the `reset_on_message` config option. It can be set to `true` only and does nothing now.
2727
To prevent services resetting after each message the "--no-reset" option in "messenger:consume" command can be set
28+
* Deprecate not setting the `http_method_override` config option. The default value will change to `false` in 7.0.
2829

2930
HttpKernel
3031
----------

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CHANGELOG
1414
* Add support for first-class callable route controller in `MicroKernelTrait`
1515
* Add tag `routing.condition_service` to autoconfigure routing condition services
1616
* Automatically register kernel methods marked with the `Symfony\Component\Routing\Annotation\Route` attribute or annotation as controllers in `MicroKernelTrait`
17+
* Deprecate not setting the `http_method_override` config option. The default value will change to `false` in 7.0.
1718

1819
6.0
1920
---

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

+13-2
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,23 @@ public function getConfigTreeBuilder(): TreeBuilder
7676
return $v;
7777
})
7878
->end()
79+
->validate()
80+
->always(function ($v) {
81+
if (!isset($v['http_method_override'])) {
82+
trigger_deprecation('symfony/framework-bundle', '6.1', 'Not setting the "framework.http_method_override" config option is deprecated. It will default to "false" in 7.0.');
83+
84+
$v['http_method_override'] = true;
85+
}
86+
87+
return $v;
88+
})
89+
->end()
7990
->fixXmlConfig('enabled_locale')
8091
->children()
8192
->scalarNode('secret')->end()
82-
->scalarNode('http_method_override')
93+
->booleanNode('http_method_override')
8394
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
84-
->defaultTrue()
95+
->treatNullLike(false)
8596
->end()
8697
->scalarNode('trust_x_sendfile_type_header')
8798
->info('Set true to enable support for xsendfile in binary file responses.')

src/Symfony/Bundle/FrameworkBundle/Tests/Command/AboutCommand/Fixture/TestAppKernel.php

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public function getProjectDir(): string
3232

3333
public function registerContainerConfiguration(LoaderInterface $loader)
3434
{
35+
$loader->load(static function (ContainerBuilder $container) {
36+
$container->loadFromExtension('framework', [
37+
'http_method_override' => false,
38+
]);
39+
});
3540
}
3641

3742
protected function build(ContainerBuilder $container)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
framework:
2+
http_method_override: false
23
secret: test

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

+14-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ConfigurationTest extends TestCase
3333
public function testDefaultConfig()
3434
{
3535
$processor = new Processor();
36-
$config = $processor->processConfiguration(new Configuration(true), [['secret' => 's3cr3t']]);
36+
$config = $processor->processConfiguration(new Configuration(true), [['http_method_override' => false, 'secret' => 's3cr3t']]);
3737

3838
$this->assertEquals(self::getBundleDefaultConfig(), $config);
3939
}
@@ -57,7 +57,7 @@ public function testInvalidSessionName($sessionName)
5757
$processor = new Processor();
5858
$processor->processConfiguration(
5959
new Configuration(true),
60-
[['session' => ['name' => $sessionName]]]
60+
[['http_method_override' => false, 'session' => ['name' => $sessionName]]]
6161
);
6262
}
6363

@@ -77,7 +77,7 @@ public function testAssetsCanBeEnabled()
7777
{
7878
$processor = new Processor();
7979
$configuration = new Configuration(true);
80-
$config = $processor->processConfiguration($configuration, [['assets' => null]]);
80+
$config = $processor->processConfiguration($configuration, [['http_method_override' => false, 'assets' => null]]);
8181

8282
$defaultConfig = [
8383
'enabled' => true,
@@ -103,6 +103,7 @@ public function testValidAssetsPackageNameConfiguration($packageName)
103103
$configuration = new Configuration(true);
104104
$config = $processor->processConfiguration($configuration, [
105105
[
106+
'http_method_override' => false,
106107
'assets' => [
107108
'packages' => [
108109
$packageName => [],
@@ -135,6 +136,7 @@ public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMess
135136
$configuration = new Configuration(true);
136137
$processor->processConfiguration($configuration, [
137138
[
139+
'http_method_override' => false,
138140
'assets' => $assetConfig,
139141
],
140142
]);
@@ -184,6 +186,7 @@ public function testValidLockConfiguration($lockConfig, $processedConfig)
184186
$configuration = new Configuration(true);
185187
$config = $processor->processConfiguration($configuration, [
186188
[
189+
'http_method_override' => false,
187190
'lock' => $lockConfig,
188191
],
189192
]);
@@ -244,11 +247,13 @@ public function testLockMergeConfigs()
244247
$configuration = new Configuration(true);
245248
$config = $processor->processConfiguration($configuration, [
246249
[
250+
'http_method_override' => false,
247251
'lock' => [
248252
'payload' => 'flock',
249253
],
250254
],
251255
[
256+
'http_method_override' => false,
252257
'lock' => [
253258
'payload' => 'semaphore',
254259
],
@@ -275,6 +280,7 @@ public function testValidSemaphoreConfiguration($semaphoreConfig, $processedConf
275280
$configuration = new Configuration(true);
276281
$config = $processor->processConfiguration($configuration, [
277282
[
283+
'http_method_override' => false,
278284
'semaphore' => $semaphoreConfig,
279285
],
280286
]);
@@ -327,6 +333,7 @@ public function testItShowANiceMessageIfTwoMessengerBusesAreConfiguredButNoDefau
327333

328334
$processor->processConfiguration($configuration, [
329335
'framework' => [
336+
'http_method_override' => false,
330337
'messenger' => [
331338
'default_bus' => null,
332339
'buses' => [
@@ -344,6 +351,7 @@ public function testBusMiddlewareDontMerge()
344351
$configuration = new Configuration(true);
345352
$config = $processor->processConfiguration($configuration, [
346353
[
354+
'http_method_override' => false,
347355
'messenger' => [
348356
'default_bus' => 'existing_bus',
349357
'buses' => [
@@ -358,6 +366,7 @@ public function testBusMiddlewareDontMerge()
358366
],
359367
],
360368
[
369+
'http_method_override' => false,
361370
'messenger' => [
362371
'buses' => [
363372
'common_bus' => [
@@ -406,6 +415,7 @@ public function testItErrorsWhenDefaultBusDoesNotExist()
406415

407416
$processor->processConfiguration($configuration, [
408417
[
418+
'http_method_override' => false,
409419
'messenger' => [
410420
'default_bus' => 'foo',
411421
'buses' => [
@@ -420,7 +430,7 @@ public function testItErrorsWhenDefaultBusDoesNotExist()
420430
protected static function getBundleDefaultConfig()
421431
{
422432
return [
423-
'http_method_override' => true,
433+
'http_method_override' => false,
424434
'trust_x_sendfile_type_header' => false,
425435
'ide' => '%env(default::SYMFONY_IDE)%',
426436
'default_locale' => 'en',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'assets' => [
56
'version' => 'SomeVersionScheme',
67
'base_urls' => 'http://cdn.example.com',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets_disabled.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'assets' => [
56
'enabled' => false,
67
],

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets_version_strategy_as_service.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'assets' => [
56
'version_strategy' => 'assets.custom_version_strategy',
67
'base_urls' => 'http://cdn.example.com',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'cache' => [
56
'pools' => [
67
'cache.foo' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'cache' => [
56
'app' => 'cache.adapter.redis_tag_aware',
67
],

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware_pool.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'cache' => [
56
'app' => 'cache.redis_tag_aware.foo',
67
'pools' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/csrf.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'csrf_protection' => true,
56
'session' => [
67
'storage_factory_id' => 'session.storage.factory.native',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/csrf_needs_session.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'csrf_protection' => [
56
'enabled' => true,
67
],
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<?php
22

3-
$container->loadFromExtension('framework', []);
3+
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,]);

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/esi_and_ssi_without_fragments.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'fragments' => [
56
'enabled' => false,
67
],

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/esi_disabled.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'esi' => [
56
'enabled' => false,
67
],

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/exceptions.php

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
44

55
$container->loadFromExtension('framework', [
6+
'http_method_override' => false,
67
'exceptions' => [
78
BadRequestHttpException::class => [
89
'log_level' => 'info',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/form_default_csrf.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'form' => [
56
'legacy_error_messages' => false,
67
],

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/form_no_csrf.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'form' => [
56
'csrf_protection' => [
67
'enabled' => false,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/fragments_and_hinclude.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'fragments' => [
56
'enabled' => true,
67
'hinclude_default_template' => 'global_hinclude_template',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/html_sanitizer.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'html_sanitizer' => [
56
'default' => 'my.sanitizer',
67
'sanitizers' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_default_options.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'http_client' => [
56
'max_host_connections' => 4,
67
'default_options' => null,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_full_default_options.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'http_client' => [
56
'default_options' => [
67
'headers' => ['X-powered' => 'PHP'],

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_mock_response_factory.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'http_client' => [
56
'default_options' => null,
67
'mock_response_factory' => 'my_response_factory',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_override_default_options.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'http_client' => [
56
'max_host_connections' => 4,
67
'default_options' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_retry.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'http_client' => [
56
'default_options' => [
67
'retry_failed' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_scoped_without_query_option.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'http_client' => [
56
'scoped_clients' => [
67
'foo' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_xml_key.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'http_client' => [
56
'default_options' => [
67
'resolve' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/legacy_translator_enabled_locales.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'secret' => 's3cr3t',
56
'default_locale' => 'fr',
67
'router' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'mailer' => [
56
'dsn' => 'smtp://example.com',
67
'envelope' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_disabled_message_bus.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'mailer' => [
56
'dsn' => 'smtp://example.com',
67
'message_bus' => false,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
return static function (ContainerConfigurator $container) {
66
$container->extension('framework', [
7+
'http_method_override' => false,
78
'mailer' => [
89
'dsn' => 'smtp://example.com',
910
'envelope' => [

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_specific_message_bus.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
45
'mailer' => [
56
'dsn' => 'smtp://example.com',
67
'message_bus' => 'app.another_bus',

0 commit comments

Comments
 (0)