From 33d9f917dcc7a1a3dd0356586ac502a4e45565fc Mon Sep 17 00:00:00 2001 From: Francis Gonzales Date: Wed, 3 Sep 2014 10:38:53 -0500 Subject: [PATCH 1/8] Windows Installation Details this closes #3186 Windows Installation Details --- doc/00-intro.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/00-intro.md b/doc/00-intro.md index f86ee400f..11cbed4a4 100644 --- a/doc/00-intro.md +++ b/doc/00-intro.md @@ -147,7 +147,9 @@ Create a new `composer.bat` file alongside `composer.phar`: C:\bin>echo @php "%~dp0composer.phar" %*>composer.bat ``` -Close your current terminal. Test usage with a new terminal: +Add the directory to your path environment and close your current terminal. + +Test usage with a new terminal: ```sh C:\Users\username>composer -V From 5dd2b30b18e5846bcf4883c7fb3b8806bbe16a55 Mon Sep 17 00:00:00 2001 From: Francis Gonzales Date: Wed, 3 Sep 2014 10:43:13 -0500 Subject: [PATCH 2/8] Windows Installation Details Add break line --- doc/00-intro.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/00-intro.md b/doc/00-intro.md index 11cbed4a4..68e99fc54 100644 --- a/doc/00-intro.md +++ b/doc/00-intro.md @@ -147,9 +147,9 @@ Create a new `composer.bat` file alongside `composer.phar`: C:\bin>echo @php "%~dp0composer.phar" %*>composer.bat ``` -Add the directory to your path environment and close your current terminal. +Add the directory to your path environment. -Test usage with a new terminal: +Close your current terminal. Test usage with a new terminal: ```sh C:\Users\username>composer -V From a256f3dfca25135a1da2cda749ee0ef8c3d03fa3 Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Tue, 2 Jun 2015 14:03:45 +0200 Subject: [PATCH 3/8] Added one failing testcase and one successful Demonstrates that it handles x.y.z properly as long as z !== 0 --- .../Test/Package/Version/VersionParserTest.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php index 5162c1814..ec248a2b7 100644 --- a/tests/Composer/Test/Package/Version/VersionParserTest.php +++ b/tests/Composer/Test/Package/Version/VersionParserTest.php @@ -374,12 +374,15 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase public function hyphenConstraints() { return array( - array('1 - 2', new VersionConstraint('>=', '1.0.0.0-dev'), new VersionConstraint('<', '3.0.0.0-dev')), - array('1.2.3 - 2.3.4.5', new VersionConstraint('>=', '1.2.3.0-dev'), new VersionConstraint('<=', '2.3.4.5')), - array('1.2-beta - 2.3', new VersionConstraint('>=', '1.2.0.0-beta'), new VersionConstraint('<', '2.4.0.0-dev')), - array('1.2-beta - 2.3-dev', new VersionConstraint('>=', '1.2.0.0-beta'), new VersionConstraint('<=', '2.3.0.0-dev')), - array('1.2-RC - 2.3.1', new VersionConstraint('>=', '1.2.0.0-RC'), new VersionConstraint('<=', '2.3.1.0')), - array('1.2.3-alpha - 2.3-RC', new VersionConstraint('>=', '1.2.3.0-alpha'), new VersionConstraint('<=', '2.3.0.0-RC')), + array('1 - 2', new VersionConstraint('>=', '1.0.0.0-dev'), new VersionConstraint('<', '3.0.0.0-dev')), + array('1.2.3 - 2.3.4.5', new VersionConstraint('>=', '1.2.3.0-dev'), new VersionConstraint('<=', '2.3.4.5')), + array('1.2-beta - 2.3', new VersionConstraint('>=', '1.2.0.0-beta'), new VersionConstraint('<', '2.4.0.0-dev')), + array('1.2-beta - 2.3-dev', new VersionConstraint('>=', '1.2.0.0-beta'), new VersionConstraint('<=', '2.3.0.0-dev')), + array('1.2-RC - 2.3.1', new VersionConstraint('>=', '1.2.0.0-RC'), new VersionConstraint('<=', '2.3.1.0')), + array('1.2.3-alpha - 2.3-RC', new VersionConstraint('>=', '1.2.3.0-alpha'), new VersionConstraint('<=', '2.3.0.0-RC')), + array('1 - 2.1', new VersionConstraint('>=', '1.0.0.0-dev'), new VersionConstraint('<', '2.2.0.0-dev')), + array('1.2 - 2.1.0', new VersionConstraint('>=', '1.2.0.0-dev'), new VersionConstraint('<=', '2.1.0.0')), + array('1.2 - 2.1.3', new VersionConstraint('>=', '1.2.0.0-dev'), new VersionConstraint('<=', '2.1.3.0')), ); } From a0ca1d4d9669ae644855972ad831b91336dea938 Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Tue, 2 Jun 2015 14:11:31 +0200 Subject: [PATCH 4/8] Consider 0 as part of a version --- src/Composer/Package/Version/VersionParser.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index de0c624f3..71f39ee54 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -416,7 +416,11 @@ class VersionParser $lowVersion = $this->normalize($matches['from']); $lowerBound = new VersionConstraint('>=', $lowVersion . $lowStabilitySuffix); - if ((!empty($matches[11]) && !empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) { + $empty = function ($x) { + return ($x === 0 || $x === "0") ? false : empty($x); + }; + + if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) { $highVersion = $this->normalize($matches['to']); $upperBound = new VersionConstraint('<=', $highVersion); } else { From 46e0a506b9dd17dabd23397639ff3f85fe97c6b6 Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Tue, 2 Jun 2015 14:20:48 +0200 Subject: [PATCH 5/8] Added another testcase + fix --- src/Composer/Package/Version/VersionParser.php | 2 +- tests/Composer/Test/Package/Version/VersionParserTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index 71f39ee54..3a214f150 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -425,7 +425,7 @@ class VersionParser $upperBound = new VersionConstraint('<=', $highVersion); } else { $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]); - $highVersion = $this->manipulateVersionString($highMatch, empty($matches[11]) ? 1 : 2, 1) . '-dev'; + $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev'; $upperBound = new VersionConstraint('<', $highVersion); } diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php index ec248a2b7..ceb959051 100644 --- a/tests/Composer/Test/Package/Version/VersionParserTest.php +++ b/tests/Composer/Test/Package/Version/VersionParserTest.php @@ -380,9 +380,10 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase array('1.2-beta - 2.3-dev', new VersionConstraint('>=', '1.2.0.0-beta'), new VersionConstraint('<=', '2.3.0.0-dev')), array('1.2-RC - 2.3.1', new VersionConstraint('>=', '1.2.0.0-RC'), new VersionConstraint('<=', '2.3.1.0')), array('1.2.3-alpha - 2.3-RC', new VersionConstraint('>=', '1.2.3.0-alpha'), new VersionConstraint('<=', '2.3.0.0-RC')), + array('1 - 2.0', new VersionConstraint('>=', '1.0.0.0-dev'), new VersionConstraint('<', '2.1.0.0-dev')), array('1 - 2.1', new VersionConstraint('>=', '1.0.0.0-dev'), new VersionConstraint('<', '2.2.0.0-dev')), array('1.2 - 2.1.0', new VersionConstraint('>=', '1.2.0.0-dev'), new VersionConstraint('<=', '2.1.0.0')), - array('1.2 - 2.1.3', new VersionConstraint('>=', '1.2.0.0-dev'), new VersionConstraint('<=', '2.1.3.0')), + array('1.3 - 2.1.3', new VersionConstraint('>=', '1.3.0.0-dev'), new VersionConstraint('<=', '2.1.3.0')), ); } From 89885140d357d0c368f0e178fe697a52d69db119 Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Tue, 2 Jun 2015 15:04:58 +0200 Subject: [PATCH 6/8] Created a failing test case --- .../Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php index a0df20f72..075ee8253 100644 --- a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php @@ -47,7 +47,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase 'description' => 'Foo bar', 'version' => '1.0.0', 'type' => 'library', - 'keywords' => array('a', 'b_c', 'D E'), + 'keywords' => array('a', 'b_c', 'D E', 'éîüø', '微信'), 'homepage' => 'https://foo.com', 'time' => '2010-10-10T10:10:10+00:00', 'license' => 'MIT', From 0f04f97088bc95ee050750676caf37b8542d4720 Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Tue, 2 Jun 2015 15:05:08 +0200 Subject: [PATCH 7/8] Fixed failing testcase --- src/Composer/Package/Loader/ValidatingArrayLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index c3377019b..86386989c 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -70,7 +70,7 @@ class ValidatingArrayLoader implements LoaderInterface $this->validateArray('scripts'); // TODO validate event names & listener syntax $this->validateString('description'); $this->validateUrl('homepage'); - $this->validateFlatArray('keywords', '[A-Za-z0-9 ._-]+'); + $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+'); if (isset($this->config['license'])) { if (is_string($this->config['license'])) { From 65dd1f7137abf80b08a1dac29379bf266a425474 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 2 Jun 2015 14:47:52 +0100 Subject: [PATCH 8/8] Update 00-intro.md --- doc/00-intro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/00-intro.md b/doc/00-intro.md index 6e0b5a1c8..0496390ca 100644 --- a/doc/00-intro.md +++ b/doc/00-intro.md @@ -142,7 +142,7 @@ Create a new `composer.bat` file alongside `composer.phar`: C:\bin>echo @php "%~dp0composer.phar" %*>composer.bat ``` -Add the directory to your path environment. +Add the directory to your PATH environment variable if it isn't already. Close your current terminal. Test usage with a new terminal: