Skip to content

Commit 7318816

Browse files
edomatonicolas-grekas
authored andcommitted
[Lock] Check the correct SQLSTATE error code for MySQL
* Closes bug: symfony#54091 Signed-off-by: Ernesto Domato <edomato@gmail.com>
1 parent 7dae80d commit 7318816

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)