[BUGFIX] Fix wrong path handling in DocumentationFile 37/51637/2
authorNicole Cordes <typo3@cordes.co>
Sat, 11 Feb 2017 16:11:39 +0000 (17:11 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Mon, 13 Feb 2017 21:55:53 +0000 (22:55 +0100)
Currently several unit tests are failing on Windows system due to the
usage of DIRECTORY_SEPARATOR. This patch ensures unix-like paths are
used everywhere and tests are running again.

Resolves: #79759
Releases: master
Change-Id: I60d8e2c31b56fae627c59b8aa4e8fed0eb85b0a9
Reviewed-on: https://review.typo3.org/51637
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Jasmina Ließmann <code@frauliessmann.de>
Tested-by: Jasmina Ließmann <code@frauliessmann.de>
Reviewed-by: Christian Matthes
Tested-by: Christian Matthes
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php

index cbc2622..08546e1 100644 (file)
@@ -73,9 +73,9 @@ class DocumentationFile
         $versionDirectories = scandir($path);
 
         $fileInfo = pathinfo($path);
-        $absolutePath = $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['basename'];
+        $absolutePath = strtr($fileInfo['dirname'], '\\', '/') . '/' . $fileInfo['basename'];
         foreach ($versionDirectories as $version) {
-            $directory = $absolutePath . DIRECTORY_SEPARATOR . $version;
+            $directory = $absolutePath . '/' . $version;
             $documentationFiles += $this->getDocumentationFilesForVersion($directory, $version);
         }
         $this->tagsTotal = $this->collectTagTotal($documentationFiles);
@@ -227,12 +227,12 @@ class DocumentationFile
         $documentationFiles = [];
         if ($this->isRelevantDirectory($docDirectory, $version)) {
             $documentationFiles[$version] = [];
-            $absolutePath = dirname($docDirectory) . DIRECTORY_SEPARATOR . $version;
+            $absolutePath = strtr(dirname($docDirectory), '\\', '/') . '/' . $version;
             $rstFiles = scandir($docDirectory);
             foreach ($rstFiles as $file) {
                 $fileInfo = pathinfo($file);
                 if ($this->isRelevantFile($fileInfo)) {
-                    $filePath = $absolutePath . DIRECTORY_SEPARATOR . $fileInfo['basename'];
+                    $filePath = $absolutePath . '/' . $fileInfo['basename'];
                     $documentationFiles[$version] += $this->getListEntry($filePath);
                 }
             }