Skip to content

Commit

Permalink
name exception being caught as it is accessed in the catch block
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Nov 20, 2023
1 parent 861d85f commit 75781d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Adapter/PdoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 75781d0

Please sign in to comment.