From: Tim Düsterhus Date: Fri, 28 Aug 2015 17:17:04 +0000 (+0200) Subject: Guard against stupid forum software containing duplicate subscriptions X-Git-Tag: 2.1.7~17 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a3d486408bf1ce30aa88223a75e2d7fa2da6bc0f;p=GitHub%2FWoltLab%2FWCF.git Guard against stupid forum software containing duplicate subscriptions --- diff --git a/wcfsetup/install/files/lib/system/importer/AbstractWatchedObjectImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractWatchedObjectImporter.class.php index 2b1ce6f44c..ff1c719aa7 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractWatchedObjectImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractWatchedObjectImporter.class.php @@ -1,6 +1,7 @@ getNewID('com.woltlab.wcf.user', $data['userID']); if (!$data['userID']) return 0; - $watch = UserObjectWatchEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID))); + try { + $watch = UserObjectWatchEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID))); + } + catch (DatabaseException $e) { + // 23000 = INTEGRITY CONSTRAINT VIOLATION a.k.a. duplicate key + if ($e->getCode() != 23000) { + throw $e; + } + } + return $watch->watchID; } }