composer: zlib_decode(): data error

My composer.json:

{
    "name": "test/test",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "require": {
        "php": ">=7.0.11",
        "symfony/symfony": "3.1.*",
        "doctrine/orm": "^2.5",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-cache-bundle": "^1.2",
        "doctrine/doctrine-migrations-bundle": "^1.1",
        "symfony/swiftmailer-bundle": "^2.3",
        "symfony/monolog-bundle": "^2.8",
        "symfony/assetic-bundle": "^2.8",
        "symfony/polyfill-apcu": "^1.0",
        "sensio/distribution-bundle": "^5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "^2.0",
        "snc/redis-bundle": "2.x-dev",
        "predis/predis": "^1.0",
        "lexik/jwt-authentication-bundle": "^1.5",
        "tss/automailer-bundle": "dev-master",
        "knplabs/knp-paginator-bundle": "^2.5",
        "fabpot/goutte": "^3.1",
        "whiteoctober/breadcrumbs-bundle": "^1.2",
        "spraed/pdf-generator-bundle": "^1.3",
        "vich/uploader-bundle": "1.2.0",
        "friendsofsymfony/jsrouting-bundle": "^1.6",
        "gregwar/captcha-bundle": "^2.0",
        "liip/imagine-bundle": "^1.6",
        "knplabs/knp-menu-bundle": "^2.0",
        "fabpot/php-cs-fixer": "^1.12",
        "symfony/serializer": "^3.1",
        "jms/serializer": "^1.3",
        "jms/serializer-bundle": "^1.1"

    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    },
    "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",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "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",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}

Output of composer diagnose:

Checking composer.json: WARNING
Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance
require.snc/redis-bundle : exact version constraints (2.x-dev) should be avoided if the package follows semantic versioning
require.tss/automailer-bundle : unbound version constraints (dev-master) should be avoided
require.vich/uploader-bundle : exact version constraints (1.2.0) should be avoided if the package follows semantic versioning
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK

When I run this command:

composer update --lock -vvv

I get the following output:

Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /home/vagrant/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /var/www/vendor/composer/installed.json
Loading plugin PackageVersions\Installer
Running 1.2.1 (2016-09-12 11:27:19) with PHP 7.0.11-1+deb.sury.org~trusty+1 on Linux / 3.13.0-86-generic
Reading ./composer.lock
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/packages.json into cache
Updating dependencies (including require-dev)
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2013.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2014.json from cache
Downloading http://packagist.org/p/provider-2015%245cb89636f37ca04dbb7ceb6ba2f12ccbc6cd3a53b2ae3528c090a56f90975e18.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2015.json into cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2016-01.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2016-04.json from cache
Downloading http://packagist.org/p/provider-2016-07%247062176fff1b75c50a0a1383e29cc73864f4c0ce30d243c1234e0833be1193c0.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2016-07.json into cache
Downloading http://packagist.org/p/provider-2016-10%244d79c57bd512ea7c9843446e53ae95329eef94e3be3511f5f701a5f400739bd0.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2016-10.json into cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-archived.json from cache
Downloading http://packagist.org/p/provider-latest%24dbfb3faaaffdfaec3494564d129e9a9310fc4a753efad4fcc8b4f91cf787398a.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-latest.json into cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$lexer.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$annotations.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-util.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-paragonie$random-compat.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-php70.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-php56.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-mbstring.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$intl.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-intl-icu.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$icu.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-php54.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$inflector.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$collections.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$cache.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$common.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-jdorn$sql-formatter.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$doctrine-bridge.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$doctrine-cache-bundle.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$dbal.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$console.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$framework-bundle.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-doctrine$doctrine-bundle.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$security-acl.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$debug.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$config.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$dependency-injection.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$event-dispatcher.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$filesystem.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$http-kernel.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$routing.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$stopwatch.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$templating.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$translation.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$http-foundation.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$finder.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$security-core.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$security-csrf.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$asset.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$class-loader.json from cache
Downloading http://packagist.org/p/symfony/cache%24a1f76f69d06d444880b68ccf242fb1bd45fc3e1ab332313999d2669d3a5e2672.json
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Downloading http://packagist.org/p/symfony/cache%24a1f76f69d06d444880b68ccf242fb1bd45fc3e1ab332313999d2669d3a5e2672.json
Downloading http://packagist.org/p/symfony/cache%24a1f76f69d06d444880b68ccf242fb1bd45fc3e1ab332313999d2669d3a5e2672.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$cache.json into cache
Downloading http://packagist.org/p/psr/log%244f0edf1b639fc9b0914c0c8d13bef27cdaa71100c3719780a0459b9dd799753d.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/provider-psr$log.json into cache
Downloading http://packagist.org/p/symfony/polyfill-php55%242c54472a8856ee39440a29ee7182c3205d88d60817040f9dea8604d9eb7f2a41.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-php55.json into cache
Downloading http://packagist.org/p/symfony/polyfill-apcu%24a910411a4953aeae3659a62e7334cc11b50e9066d4dc6a6b63ff4a665879ebb1.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-apcu.json into cache
Downloading http://packagist.org/p/psr/cache%24ed2696a6c78734dcaf8b8eb5ba4b7ebc9d2822015a1211521e390c514093e303.json
Downloading http://packagist.org/p/psr/cache%24ed2696a6c78734dcaf8b8eb5ba4b7ebc9d2822015a1211521e390c514093e303.json
Downloading http://packagist.org/p/psr/cache%24ed2696a6c78734dcaf8b8eb5ba4b7ebc9d2822015a1211521e390c514093e303.json


  [ErrorException]
  zlib_decode(): data error


Exception trace:
 () at phar:///bin/composer/src/Composer/Util/RemoteFilesystem.php:388
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 zlib_decode() at phar:///bin/composer/src/Composer/Util/RemoteFilesystem.php:388
 Composer\Util\RemoteFilesystem->get() at phar:///bin/composer/src/Composer/Util/RemoteFilesystem.php:101
 Composer\Util\RemoteFilesystem->getContents() at phar:///bin/composer/src/Composer/Repository/ComposerRepository.php:646
 Composer\Repository\ComposerRepository->fetchFile() at phar:///bin/composer/src/Composer/Repository/ComposerRepository.php:332
 Composer\Repository\ComposerRepository->whatProvides() at phar:///bin/composer/src/Composer/DependencyResolver/Pool.php:204
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///bin/composer/src/Composer/DependencyResolver/Pool.php:193
 Composer\DependencyResolver\Pool->whatProvides() at phar:///bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:161
 Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:322
 Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///bin/composer/src/Composer/DependencyResolver/Solver.php:214
 Composer\DependencyResolver\Solver->solve() at phar:///bin/composer/src/Composer/Installer.php:461
 Composer\Installer->doInstall() at phar:///bin/composer/src/Composer/Installer.php:216
 Composer\Installer->run() at phar:///bin/composer/src/Composer/Command/UpdateCommand.php:174
 Composer\Command\UpdateCommand->execute() at phar:///bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///bin/composer/vendor/symfony/console/Application.php:847
 Symfony\Component\Console\Application->doRunCommand() at phar:///bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///bin/composer/src/Composer/Console/Application.php:231
 Composer\Console\Application->doRun() at phar:///bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///bin/composer/bin/composer:43
 require() at /bin/composer:24

And I expected this to happen: Expected to update the composer.lock

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 65 (40 by maintainers)

Commits related to this issue

Most upvoted comments

Just in case somebody is redirected here because of the zlib_decode() error while trying to update dependencies using composer update

[ErrorException]
  zlib_decode(): data error

I confirm the bug is related to VirtualBox, either 5.0.28 or 5.1.8 (last stable build at the moment) is affected. As @radutopala points out, downgrading to 5.0.26 solves the problem.

I had the same problem in 3 different machines, macOS 10.10 and 10.12. In all of them composer diagnose did not report any problem.

I did many tests, create clean VM instances of Laravel Homestead and installing the Laravel framework, forcing IPv4 in the VM, disabling ssl verification of packagist, etc…

Nothing worked until I downgraded to 5.0.26.

@hectornguyen Virtualbox had a bug breaking HTTP traffic using Gzip. And composer update can precisely make HTTP requests to servers using Gzip on the JSON responses.

I had this error on Homestead image with Vagrant 1.8.1 and Virtual box 5.1.8 on Mac Os. Downgrading to Virtualbox 5.0.26 and composer update completes without a problem.

Virtualbox 5.1.14 r112924 (currently the latest release) works too

@magnetik can you try with https:// on packagist as well? And try with http:// on @alcohol’s server? Because that’s the one difference I see here, is that you used https on his and http on packagist. If that solves it, then use composer config -g repo.packagist composer https://packagist.org to force https always on packagist. That tends to solve bad proxies and snoopy networks that mess with traffic.

Hi, I had the same problem. Downgrading VirtualBox from 5.1.8 to 5.1.6 helped.

@alcohol this fixed my issue: https://github.com/composer/composer/issues/4121#issuecomment-123701983. So basically forcing https did it…

The issue was happening in Vagrant boxes, with any kind of php or composer version. Using https://gist.github.com/radutopala/8761ac647ee165d373b0c6d727cd56ea, intermittently I got from 1 to 20 retries until successful decoding the gzip.

Virtualbox 5.0.30 r112061 worked well in my case…

@mihhac @thats4shaw Good to know that 5.1.6 is the latest version of the 5.1 branch that doesn’t suffer from this problem.

Does anyone have the networking expertise to chime-in on the VirtualBox thread at https://forums.virtualbox.org/viewtopic.php?f=3&t=80396&p=376826 ? That would be hugely helpful to the rest of us. 😃