Topic: PHP 7.2.17 problème avec composer

Bonjour Rémi,

Depuis le passage à PHP 7.2.17 sur mes machines en centos 7, l'utilisation de composer est impossible :
"https://repo.packagist.org/packages.json" does not contain valid JSON
Parse error on line 1:

En repassant sur la 7.2.16 ça fonctionne correctement.
J'ai testé sur une Ubuntu avec PHP 7.2.17 et la je n'ai pas de problème, donc je suppose que le souci vient plutôt de 7.2.17 sur centos.

Est-ce que tu as besoin de plus d'informations pour pouvoir identifier le problème ?

Merci d'avance

Re: PHP 7.2.17 problème avec composer

Salut,

Il me faudrait un moyen de reproduire, car je n'ai pas rencontré de soucis

$ rpm -q php-cli composer
php-cli-7.2.17-1.el7.remi.x86_64
composer-1.8.5-1.el7.remi.noarch

$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 42 installs, 0 updates, 0 removals
  - Installing squizlabs/php_codesniffer (3.4.2): Downloading (100%)         
  - Installing phpmyadmin/coding-standard (1.0): Downloading (100%)         
  - Installing composer/ca-bundle (1.1.4): Downloading (100%)         
  - Installing blackfire/php-sdk (v1.18.0): Downloading (100%)         
  - Installing phpdocumentor/reflection-docblock (2.0.5): Downloading (100%)         
  - Installing symfony/process (v4.2.5): Downloading (100%)         
  - Installing symfony/polyfill-ctype (v1.11.0): Downloading (100%)         
  - Installing symfony/yaml (v4.2.5): Downloading (100%)         
  - Installing symfony/filesystem (v4.2.5): Downloading (100%)         
  - Installing symfony/finder (v4.2.5): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.11.0): Downloading (100%)         
  - Installing symfony/contracts (v1.0.2): Downloading (100%)         
  - Installing symfony/console (v4.2.5): Downloading (100%)         
  - Installing michelf/php-markdown (1.8.0): Downloading (100%)         
  - Installing nikic/php-parser (v3.1.5): Downloading (100%)         
  - Installing twig/twig (v2.7.4): Downloading (100%)         
  - Installing psr/container (1.0.0): Downloading (100%)         
  - Installing pimple/pimple (v3.2.3): Downloading (100%)         
  - Installing sami/sami (v4.1.2): Downloading (100%)         
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)         
  - Installing sebastian/version (2.0.1): Downloading (100%)         
  - Installing sebastian/resource-operations (2.0.1): Downloading (100%)         
  - Installing sebastian/recursion-context (3.0.0): Downloading (100%)         
  - Installing sebastian/object-reflector (1.1.1): Downloading (100%)         
  - Installing sebastian/object-enumerator (3.0.3): Downloading (100%)         
  - Installing sebastian/global-state (2.0.0): Downloading (100%)         
  - Installing sebastian/exporter (3.1.0): Downloading (100%)         
  - Installing sebastian/environment (4.1.0): Downloading (100%)         
  - Installing sebastian/diff (3.0.2): Downloading (100%)         
  - Installing sebastian/comparator (3.0.2): Downloading (100%)         
  - Installing phpunit/php-timer (2.1.1): Downloading (100%)         
  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)         
  - Installing phpunit/php-file-iterator (2.0.2): Downloading (100%)         
  - Installing theseer/tokenizer (1.1.2): Downloading (100%)         
  - Installing phpunit/php-token-stream (3.0.1): Downloading (100%)         
  - Installing phpunit/php-code-coverage (6.1.4): Downloading (100%)          
  - Installing doctrine/instantiator (1.2.0): Downloading (100%)         
  - Installing phpspec/prophecy (1.8.0): Downloading (100%)         
  - Installing phar-io/version (2.0.1): Downloading (100%)         
  - Installing phar-io/manifest (1.0.3): Downloading (100%)         
  - Installing myclabs/deep-copy (1.9.1): Downloading (100%)         
  - Installing phpunit/phpunit (7.5.8): Downloading (100%)         
blackfire/php-sdk suggests installing ext-blackfire (The C version of the Blackfire probe)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
symfony/contracts suggests installing psr/cache (When using the Cache contracts)
symfony/contracts suggests installing symfony/cache-contracts-implementation
symfony/contracts suggests installing symfony/service-contracts-implementation
symfony/contracts suggests installing symfony/translation-contracts-implementation
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
symfony/console suggests installing psr/log (For using the console logger)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)
phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
phpunit/phpunit suggests installing ext-soap (*)
phpunit/phpunit suggests installing ext-xdebug (*)
Package sami/sami is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: PHP 7.2.17 problème avec composer

à tester aussi

$ php -r 'var_dump(json_decode(file_get_contents("https://repo.packagist.org/packages.json")));'
object(stdClass)#1 (7) {
  ["packages"]=>
  array(0) {
  }
  ["notify"]=>
  string(41) "https://packagist.org/downloads/%package%"
  ["notify-batch"]=>
  string(32) "https://packagist.org/downloads/"
  ["providers-url"]=>
  string(24) "/p/%package%$%hash%.json"
...

P.S. c'est Remi, pas Rémi wink   j'y tiens

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: PHP 7.2.17 problème avec composer

Merci pour ta réponse rapide, et désolé pour l’orthographe.

Je pense que le problème vient de l'utilisation de flex sur symfony 4.2.

Je viens de trouver d'autres personnes qui ont le souci et qui utilisent tes dépôts et PHP 7.2.17 : https://github.com/symfony/flex/issues/484

Sur un projet en symfony 3.4, le composer update fonctionne sans souci avec PHP 7.2.17.

Tu peux essayer de reproduire mon problème en créant un projet symfony 4.2 de cette façon :

composer create-project "symfony/skeleton:^4.2" test

Merci

Re: PHP 7.2.17 problème avec composer

So definitely a symfony/flex issue.

Fixed upstream

Closing this one.

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test