Skip to content

Commit

Permalink
minor symfony#52666 [Cache] name exception being caught as it is acce…
Browse files Browse the repository at this point in the history
…ssed in the catch block (xabbuh)

This PR was merged into the 6.3 branch.

Discussion
----------

[Cache] name exception being caught as it is accessed in the catch block

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

Commits
-------

75781d0 name exception being caught as it is accessed in the catch block
  • Loading branch information
xabbuh committed Nov 21, 2023
2 parents 861d85f + 75781d0 commit ff29a1a
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 ff29a1a

Please sign in to comment.