8000 bug #18812 Catch \Throwable (fprochazka) · src-run/symfony@a60c355 · GitHub
[go: up one dir, main page]

Skip to content < 10000 div data-target="react-partial.reactRoot">

Commit a60c355

Browse files
bug symfony#18812 Catch \Throwable (fprochazka)
This PR was squashed before being merged into the 2.3 branch (closes symfony#18812). Discussion ---------- Catch \Throwable | Q | A | ------------- | --- | Branch? | 2.3, 2.7, 2.8, 3.0 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | Yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Related symfony#18765, symfony#15949 Commits ------- 893cf00 Catch \Throwable
2 parents 0cf017e + 893cf00 commit a60c355

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ public function load($resource, $type = null)
7777
} catch (\Exception $e) {
7878
$this->loading = false;
7979
throw $e;
80+
} catch (\Throwable $e) {
81+
$this->loading = false;
82+
throw $e;
8083
}
8184

8285
$this->loading = false;
@@ -85,7 +88,7 @@ public function load($resource, $type = null)
8588
if ($controller = $route->getDefault('_controller')) {
8689
try {
8790
$controller = $this->parser->parse($controller);
88-
} catch (\Exception $e) {
91+
} catch (\InvalidArgumentException $e) {
8992
// unable to optimize unknown notation
9093
}
9194

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
1919
use Symfony\Component\HttpFoundation\Request;
2020
use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager;
21+
use Symfony\Component\Routing\Exception\RouteNotFoundException;
2122
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2223

2324
/**
@@ -193,8 +194,8 @@ public function toolbarAction(Request $request, $token)
193194
$url = null;
194195
try {
195196
$url = $this->generator->generate('_profiler', array('token' => $token));
196-
} catch (\Exception $e) {
197-
// the profiler is not enabled
197+
} catch (RouteNotFoundException $e) {
198+
// the named route doesn't exist => the profiler is not enabled
198199
}
199200

200201
return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(

src/Symfony/Component/Config/Loader/FileLoader.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
108108
} catch (\Exception $e) {
109109
unset(self::$loading[$resource]);
110110
throw $e;
111+
} catch (\Throwable $e) {
112+
unset(self::$loading[$resource]);
113+
throw $e;
111114
}
112115

113116
unset(self::$loading[$resource]);

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
320320
return;
321321
}
322322

323+
throw $e;
324+
} catch (\Throwable $e) {
325+
unset($this->loading[$id]);
326+
unset($this->services[$id]);
327+
323328
throw $e;
324329
}
325330

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
461461
return;
462462
}
463463

464+
throw $e;
465+
} catch (\Throwable $e) {
466+
unset($this->loading[$id]);
467+
464468
throw $e;
465469
}
466470

src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
6464
$this->container->set('request', null, 'request');
6565
$this->container->leaveScope('request');
6666

67+
throw $e;
68+
} catch (\Throwable $e) {
69+
$this->container->set('request', null, 'request');
70+
$this->container->leaveScope('request');
71+
6772
throw $e;
6873
}
6974

0 commit comments

Comments
 (0)
0