From 6edabc629da47349b0591afaf1f41ae13f50ce27 Mon Sep 17 00:00:00 2001 From: Frederik Bosch Date: Wed, 24 Sep 2014 15:24:28 +0200 Subject: [PATCH] Update GitDownloader.php PHP 5.3. compat. --- src/Composer/Downloader/GitDownloader.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index 6c8b60dd9..8feb5fcc8 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -46,9 +46,10 @@ class GitDownloader extends VcsDownloader $flag = defined('PHP_WINDOWS_VERSION_MAJOR') ? '/D ' : ''; $command = 'git clone --no-checkout %s %s && cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer'; $this->io->write(" Cloning ".$ref); - - $commandCallable = function ($url) use ($ref, $path, $command) { - return sprintf($command, $this->shellEscapeUrl ($url), escapeshellarg($path), escapeshellarg($ref)); + + $downloader = $this; + $commandCallable = function ($url) use ($ref, $path, $command, $downloader) { + return sprintf($command, $downloader->shellEscapeUrl ($url), escapeshellarg($path), escapeshellarg($ref)); }; $this->gitUtil->runCommand($commandCallable, $url, $path, true); @@ -94,8 +95,9 @@ class GitDownloader extends VcsDownloader $this->io->write(" Checking out ".$ref); $command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer'; - $commandCallable = function ($url) use ($command) { - return sprintf($command, $this->shellEscapeUrl ($url)); + $downloader = $this; + $commandCallable = function ($url) use ($command, $downloader) { + return sprintf($command, $downloader->shellEscapeUrl ($url)); }; $this->gitUtil->runCommand($commandCallable, $url, $path);