From c6a096833912c7ef35febea4776121272a15c59a 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/54940
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
---
 typo3/sysext/core/Classes/Utility/CommandUtility.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/core/Classes/Utility/CommandUtility.php b/typo3/sysext/core/Classes/Utility/CommandUtility.php
index 86af2e0394ce..af99e63ae201 100644
--- a/typo3/sysext/core/Classes/Utility/CommandUtility.php
+++ b/typo3/sysext/core/Classes/Utility/CommandUtility.php
@@ -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;
-- 
GitLab