Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zlib_decode(): data error using composer in the doctrine2 tutorial

UPDATE: I posted this issue to the bug tracker a while ago as suggested in comments, and now I ran a clean installation of the new version of composer (Composer version 7131607ad1d251c790ce566119d647e008972aa5 2014-05-27 14:26:24) and the issue is fixed.

ORIGINAL POST: I'm trying to learn how to use doctrine2 using their tutorial at http://docs.doctrine-project.org/en/latest/tutorials/getting-started.html

but for some reason I get this error when trying to run composer install:

  [ErrorException]           
  zlib_decode(): data error

Here is the contents of composer.json:

{
    "require": {
        "doctrine/orm": "2.4.*",
        "symfony/yaml": "2.*"
    },
    "autoload": {
        "psr-0": {"": "src/"}
    }
}

EDIT: PHP Version 5.5.9.

EDIT: output of composer install -vvv:

Reading ./composer.json
Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Executing command (CWD): hg branch
Executing command (CWD): svn info --xml
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing C:/Users/User/AppData/Local/Composer/repo/https---packagist.org/packages.json into cache
Installing dependencies (including require-dev)
Downloading https://packagist.org/p/provider-active$1874cad4a77f2dbd91c33e813330434e6c38cd940846c58a610595dac158d161.json
Writing C:/Users/User/AppData/Local/Composer/repo/https---packagist.org/p-provider-active.json into cache
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
  [ErrorException]
  zlib_decode(): data error
Exception trace:
 () at phar://C:/composer/composer/src/Composer/Util/RemoteFilesystem.php:217
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 zlib_decode() at phar://C:/composer/composer/src/Composer/Util/RemoteFilesystem
.php:217
 Composer\Util\RemoteFilesystem->get() at phar://C:/composer/composer/src/Compos
er/Util/RemoteFilesystem.php:82
 Composer\Util\RemoteFilesystem->getContents() at phar://C:/composer/composer/sr
c/Composer/Repository/ComposerRepository.php:612
 Composer\Repository\ComposerRepository->fetchFile() at phar://C:/composer/compo
ser/src/Composer/Repository/ComposerRepository.php:519
 Composer\Repository\ComposerRepository->loadProviderListings() at phar://C:/com
poser/composer/src/Composer/Repository/ComposerRepository.php:271
 Composer\Repository\ComposerRepository->whatProvides() at phar://C:/composer/co
mposer/src/Composer/DependencyResolver/Pool.php:254
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar://C:/composer/c
omposer/src/Composer/DependencyResolver/Pool.php:243
 Composer\DependencyResolver\Pool->whatProvides() at phar://C:/composer/composer
/src/Composer/DependencyResolver/Solver.php:149
 Composer\DependencyResolver\Solver->setupInstalledMap() at phar://C:/composer/c
omposer/src/Composer/DependencyResolver/Solver.php:163
 Composer\DependencyResolver\Solver->solve() at phar://C:/composer/composer/src/
Composer/Installer.php:467
 Composer\Installer->doInstall() at phar://C:/composer/composer/src/Composer/Ins
taller.php:215
 Composer\Installer->run() at phar://C:/composer/composer/src/Composer/Command/I
nstallCommand.php:122
 Composer\Command\InstallCommand->execute() at phar://C:/composer/composer/vendo
r/symfony/console/Symfony/Component/Console/Command/Command.php:241
 Symfony\Component\Console\Command\Command->run() at phar://C:/composer/composer
/vendor/symfony/console/Symfony/Component/Console/Application.php:892
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/composer/com
poser/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar://C:/composer/composer/s
rc/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar://C:/composer/composer/vendor/sym
fony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at phar://C:/composer/composer/src
/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar://C:/composer/composer/bin/composer
:43
 require() at C:\composer\composer:15
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-p
lugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--ver
bose] [-o|--optimize-autoloader] [packages1] ... [packagesN]
like image 631
Yekhezkel Yovel Avatar asked May 18 '14 07:05

Yekhezkel Yovel


1 Answers

During the last day I've spend a lot of time trying to deal with zlib_decode(): data error problem and it definitely is not related to what exact package you are trying to install. It has to do something with proxy and/or bad internet connection. Disabling antivirus did not help my case as I'm not using antivirus on my Mac. These are the things that did help in the end.

1. Force HTTPS for package retrieval by adding this to your composer.json.

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://packagist.org"
    },
    {"packagist": false}
  ],
  "require": { /* your packages as usual */ }
}

2. If you still experience the problem, try to run composer diag. In my case few of the messages there were:

Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up

After doing composer self-update --update-keys and following the instructions - on the next attempt, all worked fine.

like image 157
ddinchev Avatar answered Nov 15 '22 15:11

ddinchev