From a3b49ae44f1c8f584c06a9e6579b9b32bb612ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 15 May 2016 22:15:48 +0200 Subject: [PATCH 1/4] Enhancement: Assert that no warning is issued when using exact version constraint for unstable package --- .../Package/Loader/ValidatingArrayLoaderTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php index 4654fc4fc..5af956fe4 100644 --- a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php @@ -326,6 +326,18 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase ), false, ), + array( + array( + 'name' => 'foo/bar', + 'require' => array( + 'bar/unstable' => '0.3.0', + ), + ), + array( + // using an exact version constraint for an unstable version should not trigger a warning + ), + false, + ), array( array( 'name' => 'foo/bar', From bb0fb0eb267cacf27496b2d6dc2040a678888232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 15 May 2016 22:24:39 +0200 Subject: [PATCH 2/4] Fix: Do not issue warning when using exact version constraint for unstable package --- src/Composer/Package/Loader/ValidatingArrayLoader.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index 13e0f7590..e60801d91 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -151,6 +151,7 @@ class ValidatingArrayLoader implements LoaderInterface } $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master')); + $stableConstraint = new Constraint('=', '1.0.0'); foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) { if ($this->validateArray($linkType) && isset($this->config[$linkType])) { @@ -183,6 +184,7 @@ class ValidatingArrayLoader implements LoaderInterface ($this->flags & self::CHECK_STRICT_CONSTRAINTS) && 'require' === $linkType && substr($linkConstraint, 0, 1) === '=' + && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=') ) { $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning'; } From c47b302a3c681095001369841b48104c22ecba87 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 17 May 2016 11:59:12 +0100 Subject: [PATCH 3/4] Reset composer before loading the modified json, fixes #5346 --- src/Composer/Command/RemoveCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Composer/Command/RemoveCommand.php b/src/Composer/Command/RemoveCommand.php index 8ab9cd35f..771f7b042 100644 --- a/src/Composer/Command/RemoveCommand.php +++ b/src/Composer/Command/RemoveCommand.php @@ -97,6 +97,7 @@ EOT } // Update packages + $this->resetComposer(); $composer = $this->getComposer(true, $input->getOption('no-plugins')); $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress')); From 360cb4ac2af350c8b96b2fd56b67ef9d5589836a Mon Sep 17 00:00:00 2001 From: Metod Date: Tue, 17 May 2016 12:06:27 +0100 Subject: [PATCH 4/4] Fix for a fatal error when system temp dir is not available --- src/Composer/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 2523ed4a7..f3743c2f6 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -188,7 +188,7 @@ class Application extends BaseApplication } // Check system temp folder for usability as it can cause weird runtime issues otherwise - Silencer::call(function() { + Silencer::call(function () use ($io) { $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime()); if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) { $io->writeError(sprintf('PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini', sys_get_temp_dir()));