Piotr Labudda 7 lat temu
rodzic
commit
60abfdd247
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      SE/se-lib/Core/Pdo.php

+ 3 - 3
SE/se-lib/Core/Pdo.php

@@ -678,9 +678,9 @@ EOF_STRUCT_MYSQL;
 		} catch (Exception $e) {
 			DBG::log($e);
 			$dbType = $this->getType();
-			$duplicateRegexp = "/SQLSTATE\[23000\]\: Integrity constraint violation: 1062 Duplicate entry '([0-9]+)' for key '(.*)'/";
-			if ('mysql' == $dbType && false !== preg_match_all($duplicateRegexp, $e->getMessage(), $matches)) {
-				DBG::nicePrint($matches, '$matches duplicate test');
+			$duplicateRegexp = "/^SQLSTATE\[23000\]\: Integrity constraint violation: 1062 Duplicate entry '([0-9]+)' for key '(.*)'/";
+			if ('mysql' == $dbType && preg_match_all($duplicateRegexp, $e->getMessage(), $matches) > 0) {
+				DBG::log(['matches'=>$matches,'msg'=>$e->getMessage(),'regex'=>$duplicateRegexp], 'array', '$matches duplicate test');
 				throw new MysqlDuplicateEntryException("Duplicate entry '{$matches[1][0]}'", 1062, null, $matches[1][0], $matches[2][0]);
 			} else {
 				throw $e;