Fix duplicate key messages for MySQL >= 8.0.19

[MAILPOET-2642]
This commit is contained in:
Jan Jakeš
2020-01-23 13:37:46 +01:00
committed by Jack Kitterhing
parent dc7e87a67f
commit 996b58a388
3 changed files with 3 additions and 2 deletions

View File

@ -232,7 +232,7 @@ class Model extends \MailPoetVendor\Sudzy\ValidModel {
} catch (\PDOException $e) {
switch ($e->getCode()) {
case 23000:
preg_match("/for key \'(.*?)\'/i", $e->getMessage(), $matches);
preg_match("/for key '(?:.*\.)*(.*?)'/i", $e->getMessage(), $matches);
if (isset($matches[1])) {
$column = $matches[1];
$this->setError(