From 75781d0b380bc5ba1307a8b95bd73341bf3e1606 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 21 Nov 2023 00:54:54 +0100 Subject: [PATCH] name exception being caught as it is accessed in the catch block --- src/Symfony/Component/Cache/Adapter/PdoAdapter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php index 976bb056b2285..cf0059e840f92 100644 --- a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php @@ -285,7 +285,7 @@ protected function doSave(array $values, int $lifetime): array|bool $lifetime = $lifetime ?: null; try { $stmt = $conn->prepare($sql); - } catch (\PDOException) { + } catch (\PDOException $e) { if ($this->isTableMissing($e) && (!$conn->inTransaction() || \in_array($this->driver, ['pgsql', 'sqlite', 'sqlsrv'], true))) { $this->createTable(); } @@ -320,7 +320,7 @@ protected function doSave(array $values, int $lifetime): array|bool foreach ($values as $id => $data) { try { $stmt->execute(); - } catch (\PDOException) { + } catch (\PDOException $e) { if ($this->isTableMissing($e) && (!$conn->inTransaction() || \in_array($this->driver, ['pgsql', 'sqlite', 'sqlsrv'], true))) { $this->createTable(); }