From e83f7c292985e4e78722afe85e4759cacc7127cc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 20 Sep 2016 18:13:22 -0700 Subject: [PATCH 1/2] Fix process timeout when set to 0 --- src/Composer/Config.php | 3 ++- tests/Composer/Test/ConfigTest.php | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Composer/Config.php b/src/Composer/Config.php index 59306f9d2..757811141 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -210,7 +210,8 @@ class Config // convert foo-bar to COMPOSER_FOO_BAR and check if it exists since it overrides the local config $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_')); - $val = rtrim($this->process($this->getComposerEnv($env) ?: $this->config[$key], $flags), '/\\'); + $val = $this->getComposerEnv($env); + $val = rtrim($this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\'); $val = Platform::expandPath($val); if (substr($key, -4) !== '-dir') { diff --git a/tests/Composer/Test/ConfigTest.php b/tests/Composer/Test/ConfigTest.php index 0d35faf6a..ac9aa8884 100644 --- a/tests/Composer/Test/ConfigTest.php +++ b/tests/Composer/Test/ConfigTest.php @@ -291,4 +291,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ); $this->assertTrue($config->get('disable-tls')); } + + public function testProcessTimeout() + { + putenv('COMPOSER_PROCESS_TIMEOUT=0'); + $config = new Config(true); + $this->assertEquals(0, $config->get('process-timeout')); + } } From 1cf4ecd648e3e51b215bc1105c4598f52de78602 Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Wed, 21 Sep 2016 11:34:28 +0200 Subject: [PATCH 2/2] remove env variable after test assertion --- tests/Composer/Test/ConfigTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Composer/Test/ConfigTest.php b/tests/Composer/Test/ConfigTest.php index ac9aa8884..81d7646dd 100644 --- a/tests/Composer/Test/ConfigTest.php +++ b/tests/Composer/Test/ConfigTest.php @@ -297,5 +297,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase putenv('COMPOSER_PROCESS_TIMEOUT=0'); $config = new Config(true); $this->assertEquals(0, $config->get('process-timeout')); + putenv('COMPOSER_PROCESS_TIMEOUT'); } }