Skip to content

Commit bfbc8f7

Browse files
[HttpKernel] Add request attribute _handle_all_throwables to allow HttpKernel to handle thrown Error in addition to Exception
1 parent c63bd7e commit bfbc8f7

File tree

28 files changed

+28
-117
lines changed

28 files changed

+28
-117
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CHANGELOG
66

77
* Add `resolve-env` option to `debug:config` command to display actual values of environment variables in dumped configuration
88
* Add `NotificationAssertionsTrait`
9-
* Add option `framework.catch_all_throwables` to allow `Symfony\Component\HttpKernel\HttpKernel` to catch all kinds of `Throwable`
109
* Make `AbstractController::render()` able to deal with forms and deprecate `renderForm()`
1110
* Deprecate the `Symfony\Component\Serializer\Normalizer\ObjectNormalizer` and
1211
`Symfony\Component\Serializer\Normalizer\PropertyNormalizer` autowiring aliases, type-hint against

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ public function getConfigTreeBuilder(): TreeBuilder
133133
->scalarNode('error_controller')
134134
->defaultValue('error_controller')
135135
->end()
136-
->booleanNode('catch_all_throwables')->defaultFalse()->info('HttpKernel will catch all kinds of \Throwable')->end()
137136
->end()
138137
;
139138

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ public function load(array $configs, ContainerBuilder $container)
330330

331331
$container->getDefinition('locale_listener')->replaceArgument(3, $config['set_locale_from_accept_language']);
332332
$container->getDefinition('response_listener')->replaceArgument(1, $config['set_content_language_from_locale']);
333-
$container->getDefinition('http_kernel')->replaceArgument(4, $config['catch_all_throwables']);
334333

335334
// If the slugger is used but the String component is not available, we should throw an error
336335
if (!ContainerBuilder::willBeAvailable('symfony/string', SluggerInterface::class, ['symfony/framework-bundle'])) {

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
8989
service('controller_resolver'),
9090
service('request_stack'),
9191
service('argument_resolver'),
92-
false,
9392
])
9493
->tag('container.hot_path')
9594
->tag('container.preload', ['class' => HttpKernelRunner::class])

src/Symfony/Bundle/FrameworkBundle/Test/ExceptionSubscriber.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
657657
'sanitizers' => [],
658658
],
659659
'exceptions' => [],
660-
'catch_all_throwables' => false,
661660
];
662661
}
663662
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/UidTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
1313

14-
use Symfony\Bundle\FrameworkBundle\Test\ExceptionSubscriber;
1514
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller\UidController;
1615
use Symfony\Component\Uid\Ulid;
1716
use Symfony\Component\Uid\UuidV1;
@@ -30,15 +29,12 @@ protected function setUp(): void
3029
public function testArgumentValueResolverDisabled()
3130
{
3231
$client = $this->createClient(['test_case' => 'Uid', 'root_config' => 'config_disabled.yml']);
32+
$client->catchExceptions(false);
3333

34-
$client->request('GET', '/1/uuid-v1/'.new UuidV1());
35-
$this->assertSame(500, $client->getResponse()->getStatusCode());
36-
$exceptions = ExceptionSubscriber::shiftAll();
37-
$this->assertCount(1, $exceptions);
38-
$exception = reset($exceptions);
34+
$this->expectException(\TypeError::class);
35+
$this->expectExceptionMessage('Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller\UidController::anyFormat(): Argument #1 ($userId) must be of type Symfony\Component\Uid\UuidV1, string given');
3936

40-
$this->assertInstanceOf(\TypeError::class, $exception);
41-
$this->assertStringContainsString(UidController::class.'::anyFormat(): Argument #1 ($userId) must be of type Symfony\Component\Uid\UuidV1, string given', $exception->getMessage());
37+
$client->request('GET', '/1/uuid-v1/'.new UuidV1());
4238
}
4339

4440
public function testArgumentValueResolverEnabled()

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Uid/config_disabled.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,3 @@ framework:
55
http_method_override: false
66
uid:
77
enabled: false
8-
9-
services:
10-
Symfony\Bundle\FrameworkBundle\Test\ExceptionSubscriber:
11-
tags:
12-
- { name: kernel.event_subscriber }

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ framework:
1111
enabled_locales: ['en', 'fr']
1212
session:
1313
storage_factory_id: session.storage.factory.mock_file
14-
catch_all_throwables: true
1514

1615
services:
1716
logger: { class: Psr\Log\NullLogger }

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
8686
'http_method_override' => false,
8787
'secret' => '$ecret',
8888
'router' => ['utf8' => true],
89-
'catch_all_throwables' => true,
9089
]);
9190

9291
$c->setParameter('halloween', 'Have a great day!');

0 commit comments

Comments
 (0)