From c889b7dbcbb3293050c92bad7285f48cfeefed3e Mon Sep 17 00:00:00 2001
From: Nicole Cordes <typo3@cordes.co>
Date: Wed, 6 Dec 2017 01:19:02 +0100
Subject: [PATCH] [BUGFIX] Use correct path variable on Windows

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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/core/Classes/Utility/CommandUtility.php b/typo3/sysext/core/Classes/Utility/CommandUtility.php
index 6df819ee67f7..52500f119751 100644
--- a/typo3/sysext/core/Classes/Utility/CommandUtility.php
+++ b/typo3/sysext/core/Classes/Utility/CommandUtility.php
@@ -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;
-- 
GitLab