3

无法使用 composer update -v 更新“更新依赖项(包括 require-dev)”

使用 Windows 7 PHP:为 CLI Composer 版本 c93aecee4d3998d17a1986f042187d38dd394397 启用了 5.4.7 OpenSSL

得到错误:

E:\xampp\htdocs\partner-portal>composer update -v
Loading composer repositories with package information
Updating dependencies (including require-dev)

  [ErrorException]
  zlib_decode(): data error

Exception trace:
 () at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:166
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 zlib_decode() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:166
 Composer\Util\RemoteFilesystem->get() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:76
 Composer\Util\RemoteFilesystem->getContents() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:541
 Composer\Repository\ComposerRepository->fetchFile() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:278
 Composer\Repository\ComposerRepository->whatProvides() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:240
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:229
 Composer\DependencyResolver\Pool->whatProvides() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:179
 Composer\DependencyResolver\RuleSetGenerator->addRulesForPackage() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:274
 Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/Solver.php:166
 Composer\DependencyResolver\Solver->solve() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Installer.php:446
 Composer\Installer->doInstall() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Installer.php:208
 Composer\Installer->run() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Command/UpdateCommand.php:103
 Composer\Command\UpdateCommand->execute() at phar://C:/ProgramData/Composer/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/Composer/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:882
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/Composer/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:212
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar://C:/ProgramData/Composer/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:119
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar://C:/ProgramData/Composer/bin/composer.phar/bin/composer:43
 require() at C:\ProgramData\Composer\bin\composer.phar:15


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock]
 [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [
-o|--optimize-autoloader] [packages1] ... [packagesN]

编辑:添加 composer.json ->

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "composer/composer": "1.0.*@dev",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "incenteev/composer-parameter-handler": "~2.0",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "sonata-project/intl-bundle": "dev-master",
        "sonata-project/cache-bundle": "dev-master",
        "sonata-project/user-bundle": "dev-master",
        "sonata-project/media-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin",
        "process-timeout": 5000
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}
4

1 回答 1

2

这似乎与此问题中的问题相同。

zlib_decode(): data error

请仔细阅读我在那里回复的可能解决方案列表。

此外,请确保您的 composer.json 和 composer.phar 都不包含BOM ,而且两者都是 UTF-8 编码的。

通过使用显示更多调试消息

composer -vvv update

请尝试将Composer/Util/RemoteFilesystem.php起始行 164中的 if 语句更改为

if ($decode) {
    $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
}

您可以使用koto/phar-util来提取/重新构建您的 composer.phar。

于 2013-06-23T04:11:38.603 回答