Skip to content

VersionParser throws UnexpectedValueException on 20150920.0.0 #32

@emaijala

Description

@emaijala

Composer unable to install google-closure-compiler package with the composer-asset-plugin due to a version number parsing issue. I'm trying to install the npm packages of Angular2, but it seems that the VersionParser class thinks the version number of the package (20150920.0.0) is invalid. Looks to me the check is too strict in that it only allows the major version to be up to five digits, but just changing the check makes a date-based version string fail a phpunit test, so I wasn't quite sure how this should be handled.

Here's a minimal compos er.json to reproduce the problem:

{
    "require": {
        "npm-asset/google-closure-compiler": "20150920.0.0"
    }
}

composer -vvv update output:

composer -vvv update
Reading ./composer.json
Loading config file /Users/ere/.composer/config.json
Loading config file /Users/ere/.composer/auth.json
Loading config file ./composer.json
Executing command (/Users/ere/src/composertest): git describe --exact-match --tags
Executing command (/Users/ere/src/composertest): git branch --no-color --no-abbrev -v
Executing command (/Users/ere/src/composertest): hg branch
Executing command (/Users/ere/src/composertest): svn info --xml
Reading ./composer.json
Loading config file /Users/ere/.composer/config.json
Loading config file /Users/ere/.composer/auth.json
Loading config file ./composer.json
Executing command (/Users/ere/src/composertest): git describe --exact-match --tags
Executing command (/Users/ere/src/composertest): git branch --no-color --no-abbrev -v
Executing command (/Users/ere/src/composertest): hg branch
Executing command (/Users/ere/src/composertest): svn info --xml



  [UnexpectedValueException]
  Could not parse version constraint 20150920.0.0: Invalid version string "20150920.0.0"



Exception trace:
 () at phar:///usr/local/bin/composer/vendor/composer/semver/src/VersionParser.php:467
 Composer\Semver\VersionParser->parseConstraint() at phar:///usr/local/bin/composer/vendor/composer/semver/src/VersionParser.php:248
 Composer\Semver\VersionParser->parseConstraints() at phar:///usr/local/bin/composer/src/Composer/Package/Loader/ArrayLoader.php:234
 Composer\Package\Loader\ArrayLoader->parseLinks() at phar:///usr/local/bin/composer/src/Composer/Package/Loader/ArrayLoader.php:124
 Composer\Package\Loader\ArrayLoader->load() at phar:///usr/local/bin/composer/src/Composer/Package/Loader/RootPackageLoader.php:86
 Composer\Package\Loader\RootPackageLoader->load() at phar:///usr/local/bin/composer/src/Composer/Factory.php:284
 Composer\Factory->createComposer() at phar:///usr/local/bin/composer/src/Composer/Factory.php:504
 Composer\Factory::create() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:245
 Composer\Console\Application->getComposer() at phar:///usr/local/bin/composer/src/Composer/Command/Command.php:53
 Composer\Command\Command->getComposer() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:88
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:841
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:167
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:98
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:25


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--] [<packages>]...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions