浏览代码

fixed PDO

Piotr Labudda 7 年之前
父节点
当前提交
60abfdd247
共有 1 个文件被更改,包括 3 次插入3 次删除
  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;