Skip to content

Commit 71d7bdd

Browse files
committed
Fix upgrade path
1 parent 2841e59 commit 71d7bdd

File tree

25 files changed

+46
-11
lines changed

25 files changed

+46
-11
lines changed

UPGRADE-4.4.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ TwigBridge
214214
TwigBundle
215215
----------
216216

217-
* Deprecated `twig.exception_controller` configuration option, use `framework.error_controller` instead:
217+
* Deprecated `twig.exception_controller` configuration option, set it to "null" and use `framework.error_controller` instead:
218218

219219
Before:
220220
```yaml
@@ -224,6 +224,9 @@ TwigBundle
224224

225225
After:
226226
```yaml
227+
twig:
228+
exception_controller: null
229+
227230
framework:
228231
error_controller: 'App\Controller\MyExceptionController'
229232
```

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/BundlePaths/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ framework:
88

99
twig:
1010
strict_variables: '%kernel.debug%'
11+
exception_controller: null # to be removed in 5.0

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Fragment/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ framework:
77

88
twig:
99
strict_variables: '%kernel.debug%'
10+
exception_controller: null # to be removed in 5.0

src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/twig.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
twig:
33
debug: '%kernel.debug%'
44
strict_variables: '%kernel.debug%'
5+
exception_controller: null # to be removed in 5.0

src/Symfony/Bundle/TwigBundle/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CHANGELOG
99
* added a new `TwigHtmlErrorRenderer` for `html` format, integrated with the `ErrorRenderer` component
1010
* deprecated `ExceptionController` and `PreviewErrorController` controllers, use `ErrorController` from the `HttpKernel` component instead
1111
* deprecated all built-in error templates in favor of the new error renderer mechanism
12-
* deprecated `twig.exception_controller` configuration option, use `framework.error_controller` configuration instead
12+
* deprecated `twig.exception_controller` configuration option, set it to "null" and use `framework.error_controller` configuration instead
1313

1414
4.2.0
1515
-----

src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function process(ContainerBuilder $container)
3131

3232
// to be removed in 5.0
3333
// register the exception listener only if it's currently used, else use the provided by FrameworkBundle
34-
if ('twig.controller.exception::showAction' === $container->getParameter('twig.exception_listener.controller') && $container->hasDefinition('exception_listener')) {
34+
if (null === $container->getParameter('twig.exception_listener.controller') && $container->hasDefinition('exception_listener')) {
3535
$container->removeDefinition('twig.exception_listener');
3636
} else {
3737
$container->removeDefinition('exception_listener');

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,19 @@ public function getConfigTreeBuilder()
3535
$rootNode
3636
->children()
3737
->scalarNode('exception_controller')
38-
->defaultValue('twig.controller.exception::showAction')
39-
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.4, use "framework.error_controller" configuration key instead.')
38+
->defaultValue(static function () {
39+
@trigger_error('The "twig.exception_controller" configuration key has been deprecated in Symfony 4.4, set it to "null" and use "framework.error_controller" configuration key instead.', E_USER_DEPRECATED);
40+
41+
return 'twig.controller.exception::showAction';
42+
})
43+
->validate()
44+
->ifTrue(static function ($v) { return null !== $v; })
45+
->then(static function ($v) {
46+
@trigger_error('The "twig.exception_controller" configuration key has been deprecated in Symfony 4.4, set it to "null" and use "framework.error_controller" configuration key instead.', E_USER_DEPRECATED);
47+
48+
return $v;
49+
})
50+
->end()
4051
->end()
4152
->end()
4253
;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public function testDoNoDuplicateDefaultFormResources()
2121
{
2222
$input = [
2323
'strict_variables' => false, // to be removed in 5.0 relying on default
24+
'exception_controller' => null, // to be removed in 5.0
2425
'form_themes' => ['form_div_layout.html.twig'],
2526
];
2627

@@ -44,7 +45,7 @@ public function testGetStrictVariablesDefaultFalse()
4445

4546
/**
4647
* @group legacy
47-
* @expectedDeprecation The "twig.exception_controller" configuration key has been deprecated in Symfony 4.4, use "framework.error_controller" configuration key instead.
48+
* @expectedDeprecation The "twig.exception_controller" configuration key has been deprecated in Symfony 4.4, set it to "null" and use "framework.error_controller" configuration key instead.
4849
*/
4950
public function testGetExceptionControllerDefault()
5051
{
@@ -58,6 +59,7 @@ public function testGlobalsAreNotNormalized()
5859
{
5960
$input = [
6061
'strict_variables' => false, // to be removed in 5.0 relying on default
62+
'exception_controller' => null, // to be removed in 5.0 relying on default
6163
'globals' => ['some-global' => true],
6264
];
6365

@@ -71,6 +73,7 @@ public function testArrayKeysInGlobalsAreNotNormalized()
7173
{
7274
$input = [
7375
'strict_variables' => false, // to be removed in 5.0 relying on default
76+
'exception_controller' => null, // to be removed in 5.0 relying on default
7477
'globals' => ['global' => ['some-key' => 'some-value']],
7578
];
7679

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/customTemplateEscapingGuesser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
'autoescape_service' => 'my_project.some_bundle.template_escaping_guesser',
55
'autoescape_service_method' => 'guess',
66
'strict_variables' => false, // to be removed in 5.0 relying on default
7+
'exception_controller' => null, // to be removed in 5.0
78
]);

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/empty.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
$container->loadFromExtension('twig', [
44
'strict_variables' => false, // to be removed in 5.0 relying on default
5+
'exception_controller' => null, // to be removed in 5.0
56
]);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy