[BUGFIX] Use correct path variable on Windows 25/55025/2
authorNicole Cordes <typo3@cordes.co>
Wed, 6 Dec 2017 00:19:02 +0000 (01:19 +0100)
committerNicole Cordes <typo3@cordes.co>
Mon, 11 Dec 2017 13:15:17 +0000 (14:15 +0100)
There is a difference between Apache and CLI exposing global path
configuration on Windows Systems. The CommandUtility uses the global
path to initialize an internal path storage for possible command
resources. The patch ensures both possible keys on Windows systems are
taken into account to resolve possible application locations.

Resolves: #83234
Releases: master, 8.7, 7.6
Change-Id: Id7166042e39c4f468c10c1c489c7fe5beae7a5fc
Reviewed-on: https://review.typo3.org/55025
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Classes/Utility/CommandUtility.php

index 6df819e..52500f1 100644 (file)
@@ -399,11 +399,11 @@ class CommandUtility
             }
         }
 
-            // Add path from environment
-            // @todo how does this work for WIN
-        if ($GLOBALS['_SERVER']['PATH']) {
-            $sep = (TYPO3_OS == 'WIN' ? ';' : ':');
-            $envPath = GeneralUtility::trimExplode($sep, $GLOBALS['_SERVER']['PATH'], true);
+        // Add path from environment
+        if (!empty($GLOBALS['_SERVER']['PATH']) || !empty($GLOBALS['_SERVER']['Path'])) {
+            $sep = (TYPO3_OS === 'WIN' ? ';' : ':');
+            $serverPath = !empty($GLOBALS['_SERVER']['PATH']) ? $GLOBALS['_SERVER']['PATH'] : $GLOBALS['_SERVER']['Path'];
+            $envPath = GeneralUtility::trimExplode($sep, $serverPath, true);
             foreach ($envPath as $val) {
                 $val = self::fixPath($val);
                 $sysPathArr[$val] = $val;