From: Tim Düsterhus Date: Thu, 19 Aug 2021 14:43:57 +0000 (+0200) Subject: Fix check whether a non-owned index is being dropped in DatabaseTableChangeProcessor X-Git-Tag: 5.4.5_RC_1~36 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1166e76df0bff3879a708caef8619d38370aec7a;p=GitHub%2FWoltLab%2FWCF.git Fix check whether a non-owned index is being dropped in DatabaseTableChangeProcessor The reproducer and fix is effectively identical to the one in d7f721d6f920d66f75102723b504d89e57a8c9ff. Package A: Installs KEY someIndex (`UNIQUE`) Package B: Installs UNIQUE KEY someIndex2 (`UNIQUE`) Package B: Drops UNIQUE KEY someIndex2 (`UNIQUE`) It was erroneously detected that Package B would drop the index owned by Package A. The actual dropping logic was already correct, just the safety check was incorrect. --- diff --git a/wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php b/wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php index 7bd6d57ea9..3ee2a2b7b6 100644 --- a/wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php @@ -1199,7 +1199,7 @@ class DatabaseTableChangeProcessor foreach ($table->getIndices() as $index) { foreach ($existingIndices as $existingIndex) { - if (empty(\array_diff($index->getData(), $existingIndex->getData()))) { + if (empty(\array_diff_assoc($index->getData(), $existingIndex->getData()))) { if ($index->willBeDropped()) { if ($this->getIndexPackageID($table, $index) !== $this->package->packageID) { $errors[] = [