Fix calculation of document root in PackageInstallationDispatcher
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 4 Aug 2016 13:09:38 +0000 (15:09 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 4 Aug 2016 13:15:13 +0000 (15:15 +0200)
see 89ff24b4ac52c37ab3c4205277e335c061a6a887

wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php

index 8dfbbdb181e9502116e846e5f1bd877d08b7ade8..600573edb0385c8a01205dae3e05cacdfb54f1eb 100644 (file)
@@ -794,18 +794,7 @@ class PackageInstallationDispatcher {
                                        $wcfDomainPath = $row['domainPath'];
                                }
                                
-                               $documentRoot = '';
-                               
-                               // strip longest common suffix
-                               $a = strrev(FileUtil::unifyDirSeparator($wcfDomainPath));
-                               $b = strrev($documentRoot = FileUtil::unifyDirSeparator(WCF_DIR));
-                               for ($i = 0, $max = min(strlen($a), strlen($b)); $i < $max; $i++) {
-                                       if ($a{$i} !== $b{$i}) {
-                                               $documentRoot = substr(strrev($b), 0, -$i);
-                                               break;
-                                       }
-                               }
-                               
+                               $documentRoot = substr(FileUtil::unifyDirSeparator(WCF_DIR), 0, -strlen(FileUtil::unifyDirSeparator($wcfDomainPath)));
                                $domainPath = FileUtil::addLeadingSlash(FileUtil::getRelativePath($documentRoot, $packageDir));
                                
                                // update application path