We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c651e7 commit ce620a6Copy full SHA for ce620a6
src/Database/Adapter/MariaDB.php
@@ -1798,10 +1798,8 @@ protected function processException(PDOException $e): \Exception
1798
1799
// Duplicate row
1800
if ($e->getCode() === '23000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1062) {
1801
- if (preg_match("/for key '(?:[^.]+\.)?([^']+)'/", $e->getMessage(), $matches)) {
1802
- if ($matches[1] === '_uid') {
1803
- return new DuplicateException('Document already exists', $e->getCode(), $e);
1804
- }
+ if (str_ends_with($e->getMessage(), "._uid'")) {
+ return new DuplicateException('Document already exists', $e->getCode(), $e);
1805
}
1806
1807
return new UniqueException('Document already exists', $e->getCode(), $e);
0 commit comments