Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lock] Check the correct SQLSTATE error code for MySQL #54201

Merged
merged 1 commit into from Mar 13, 2024

Conversation

edomato
Copy link
Contributor

@edomato edomato commented Mar 8, 2024

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #54091
License MIT

@@ -337,7 +337,7 @@ private function isTableMissing(\PDOException $exception): bool
case 'sqlite' === $driver && str_contains($exception->getMessage(), 'no such table:'):
case 'oci' === $driver && 942 === $code:
case 'sqlsrv' === $driver && 208 === $code:
case 'mysql' === $driver && 1146 === $code:
case 'mysql' === $driver && '42S02' === $code:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why we had this code and dbal is effectively doing something special to get that "1186".
Instead of this change, I'd suggest modifying L333 this way:

$code = $exception->errorInfo ? $exception->errorInfo[1] : $exception->getCode();

Note that the same code exists in src/Symfony/Component/Cache/Adapter/PdoAdapter.php

* Closes bug: symfony#54091

Signed-off-by: Ernesto Domato <edomato@gmail.com>
@nicolas-grekas
Copy link
Member

Thank you @edomato.

@nicolas-grekas nicolas-grekas merged commit 6fadff7 into symfony:5.4 Mar 13, 2024
8 of 12 checks passed
This was referenced Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants