Skip to content

Commit 6fadff7

Browse files
bug symfony#54201 [Lock] Check the correct SQLSTATE error code for MySQL (edomato)
This PR was merged into the 5.4 branch. Discussion ---------- [Lock] Check the correct SQLSTATE error code for MySQL * Closes bug: symfony#54091 | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#54091 | License | MIT Commits ------- 7318816 [Lock] Check the correct SQLSTATE error code for MySQL
2 parents 6e8d627 + 7318816 commit 6fadff7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Cache/Adapter/PdoAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ private function getServerVersion(): string
600600
private function isTableMissing(\PDOException $exception): bool
601601
{
602602
$driver = $this->driver;
603-
$code = $exception->getCode();
603+
$code = $exception->errorInfo ? $exception->errorInfo[1] : $exception->getCode();
604604

605605
switch (true) {
606606
case 'pgsql' === $driver && '42P01' === $code:

src/Symfony/Component/Lock/Store/PdoStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private function getCurrentTimestampStatement(): string
330330
private function isTableMissing(\PDOException $exception): bool
331331
{
332332
$driver = $this->getDriver();
333-
$code = $exception->getCode();
333+
$code = $exception->errorInfo ? $exception->errorInfo[1] : $exception->getCode();
334334

335335
switch (true) {
336336
case 'pgsql' === $driver && '42P01' === $code:

0 commit comments

Comments
 (0)