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(); }