Do not block matching abbreviation if the package is the same
authorAlexander Ebert <ebert@woltlab.com>
Wed, 7 Jul 2021 16:16:32 +0000 (18:16 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 7 Jul 2021 16:16:32 +0000 (18:16 +0200)
The previous code would block the installation of an update of the same package.

Fix for #4357

wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php

index 9383be3072938abac1d01041a71bf22bafd75abb..ee277e96618b78f6067074f8c7575f72d0c5a379 100644 (file)
@@ -203,10 +203,11 @@ class PackageValidationArchive implements \RecursiveIterator
     protected function validateApplication(): void
     {
         if ($this->archive->getPackageInfo('isApplication')) {
-            $abbreviation = Package::getAbbreviation($this->archive->getPackageInfo('name'));
+            $identifier = $this->archive->getPackageInfo('name');
+            $abbreviation = Package::getAbbreviation($identifier);
 
             $application = ApplicationHandler::getInstance()->getApplication($abbreviation);
-            if ($application !== null) {
+            if ($application !== null && $application->getPackage()->package !== $identifier) {
                 throw new PackageValidationException(PackageValidationException::DUPLICATE_ABBREVIATION, [
                     'packageName' => $this->archive->getPackageInfo('name'),
                     'application' => $application,