From 05fcc4adfbbb46d3ffd644f887eb292ba2dbdab1 Mon Sep 17 00:00:00 2001 From: Robert Lu Date: Thu, 4 May 2017 16:47:16 +0800 Subject: [PATCH 1/4] can use relative path for mirror --- src/Composer/Repository/ComposerRepository.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 218e23992..d62deb7c1 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -497,7 +497,10 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred'])); } if (!empty($mirror['dist-url'])) { - $this->distMirrors[] = array('url' => $mirror['dist-url'], 'preferred' => !empty($mirror['preferred'])); + $this->distMirrors[] = array( + 'url' => $this->canonicalizeUrl($mirror['dist-url']), + 'preferred' => !empty($mirror['preferred']) + ); } } } From 954300032b5cdb40cd657933702475001694680c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 16 May 2017 21:59:19 +0200 Subject: [PATCH 2/4] Avoid useless warnings when updating/removing stuff that is not installed --- src/Composer/Installer.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 57172530f..122a4e9f0 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -359,7 +359,7 @@ class Installer } $this->whitelistUpdateDependencies( - $localRepo, + $lockedRepository ?: $localRepo, $this->package->getRequires(), $this->package->getDevRequires() ); @@ -1268,11 +1268,13 @@ class Installer * skipped including their dependencies, unless they are listed in the * update whitelist themselves. * - * @param RepositoryInterface $localRepo + * @param RepositoryInterface $localOrLockRepo Use the locked repo if available, otherwise installed repo will do + * As we want the most accurate package list to work with, and installed + * repo might be empty but locked repo will always be current. * @param array $rootRequires An array of links to packages in require of the root package * @param array $rootDevRequires An array of links to packages in require-dev of the root package */ - private function whitelistUpdateDependencies($localRepo, array $rootRequires, array $rootDevRequires) + private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires) { if (!$this->updateWhitelist) { return; @@ -1291,7 +1293,7 @@ class Installer } $pool = new Pool; - $pool->addRepository($localRepo); + $pool->addRepository($localOrLockRepo); $seen = array(); From 4ce39c75c770716e2d0cdf5d313ff32b6326e6f9 Mon Sep 17 00:00:00 2001 From: "Jasper N. Brouwer" Date: Thu, 11 May 2017 21:56:42 +0200 Subject: [PATCH 3/4] Pass more ini directives when executing php Not only pass the current value for "memory_limit" along when executing php, but also do the same for "allow_url_fopen" and "disable_functions" --- src/Composer/EventDispatcher/EventDispatcher.php | 6 ++++-- src/Composer/XdebugHandler.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index 63ef134aa..cd815112b 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -257,9 +257,11 @@ class EventDispatcher throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName); } - $memoryFlag = ' -d memory_limit='.ini_get('memory_limit'); + $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ini_get('allow_url_fopen'); + $disableFunctionsFlag = ' -d disable_functions="' . ini_get('disable_functions') . '"'; + $memoryLimitFlag = ' -d memory_limit=' . ini_get('memory_limit'); - return ProcessExecutor::escape($phpPath) . $memoryFlag; + return ProcessExecutor::escape($phpPath) . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag; } /** diff --git a/src/Composer/XdebugHandler.php b/src/Composer/XdebugHandler.php index dae3ee840..f7fd8c2a1 100644 --- a/src/Composer/XdebugHandler.php +++ b/src/Composer/XdebugHandler.php @@ -174,6 +174,8 @@ class XdebugHandler $content .= $data.PHP_EOL; } + $content .= 'allow_url_fopen='.ini_get('allow_url_fopen').PHP_EOL; + $content .= 'disable_functions="'.ini_get('disable_functions').'"'.PHP_EOL; $content .= 'memory_limit='.ini_get('memory_limit').PHP_EOL; if (defined('PHP_WINDOWS_VERSION_BUILD')) { From 9824d339b67b36edf20cd5a28c48c07bc952344c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 16 May 2017 22:18:19 +0200 Subject: [PATCH 4/4] Escape arguments, refs #6414 --- src/Composer/EventDispatcher/EventDispatcher.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index cd815112b..4a5656d9f 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -257,9 +257,9 @@ class EventDispatcher throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName); } - $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ini_get('allow_url_fopen'); - $disableFunctionsFlag = ' -d disable_functions="' . ini_get('disable_functions') . '"'; - $memoryLimitFlag = ' -d memory_limit=' . ini_get('memory_limit'); + $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen')); + $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions')); + $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit')); return ProcessExecutor::escape($phpPath) . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag; }