diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index fdf0edcfb47b..01c114e54014 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -45,21 +45,15 @@ public function process(ContainerBuilder $container) $this->completeDefinition($id, $definition); } } - } catch (\Exception $e) { - } catch (\Throwable $e) { - } - - spl_autoload_unregister($throwingAutoloader); - - // Free memory and remove circular reference to container - $this->container = null; - $this->reflectionClasses = array(); - $this->definedTypes = array(); - $this->types = null; - $this->ambiguousServiceTypes = array(); - - if (isset($e)) { - throw $e; + } finally { + spl_autoload_unregister($throwingAutoloader); + + // Free memory and remove circular reference to container + $this->container = null; + $this->reflectionClasses = array(); + $this->definedTypes = array(); + $this->types = null; + $this->ambiguousServiceTypes = array(); } } diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index e2b63ea1e954..900b0bfc5501 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -215,20 +215,12 @@ public function setValue(&$objectOrArray, $propertyPath, $value) $value = $zval[self::VALUE]; } } catch (\TypeError $e) { - try { - self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0); - } catch (InvalidArgumentException $e) { + self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0); + } finally { + if (PHP_VERSION_ID < 70000 && false !== self::$previousErrorHandler) { + restore_error_handler(); + self::$previousErrorHandler = false; } - } catch (\Exception $e) { - } catch (\Throwable $e) { - } - - if (PHP_VERSION_ID < 70000 && false !== self::$previousErrorHandler) { - restore_error_handler(); - self::$previousErrorHandler = false; - } - if (isset($e)) { - throw $e; } } diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index fc6c8afe1ad8..685a7ffd3a34 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -119,23 +119,16 @@ public function setIndentPad($pad) */ public function dump(Data $data, $output = null) { - $exception = null; if ($output) { $prevOutput = $this->setOutput($output); } try { $data->dump($this); $this->dumpLine(-1); - } catch (\Exception $exception) { - // Re-thrown below - } catch (\Throwable $exception) { - // Re-thrown below - } - if ($output) { - $this->setOutput($prevOutput); - } - if (null !== $exception) { - throw $exception; + } finally { + if ($output) { + $this->setOutput($prevOutput); + } } }