From 8b221905caecc4177e90f39317411dd39bdf36d7 Mon Sep 17 00:00:00 2001 From: nishiyama Date: Fri, 25 Mar 2016 20:04:43 +0900 Subject: [PATCH] fix path info --- src/Composer/EventDispatcher/EventDispatcher.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index 7cc91b7cc..65ee752dd 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -145,13 +145,18 @@ class EventDispatcher */ protected function doDispatch(Event $event) { + $pathStr = 'PATH'; + if (!isset($_SERVER[$pathStr])) { + $pathStr = 'Path'; + } + // add the bin dir to the PATH to make local binaries of deps usable in scripts $binDir = $this->composer->getConfig()->get('bin-dir'); if (is_dir($binDir)) { $binDir = realpath($binDir); - if (isset($_SERVER['PATH']) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER['PATH'])) { - $_SERVER['PATH'] = $binDir.PATH_SEPARATOR.getenv('PATH'); - putenv('PATH='.$_SERVER['PATH']); + if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) { + $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr); + putenv($pathStr.'='.$_SERVER[$pathStr]); } }