[BUGFIX] Use correct path variable on Windows 19/55019/2
authorNicole Cordes <typo3@cordes.co>
Wed, 6 Dec 2017 00:19:02 +0000 (01:19 +0100)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Sun, 10 Dec 2017 22:29:00 +0000 (23:29 +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/55019
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/core/Classes/Utility/CommandUtility.php

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