Symfony 2.6 php7.1 fixe composer install

Dernièrement je suis passé en php7.1 avec un projet Symfony 2.6 et j'ai eu quelques soucis lors de l'utilisation de composer install et composer update. Un conflit dans la gestion des modules de php avec opcache et le bundle sensio/distribution-bundle.

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
Cannot load Zend OPcache - it was already loaded
PHP Warning:  Module 'mysqlnd' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'xml' already loaded in Unknown on line 0
...
Console
Log Error Detail ```console > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap Cannot load Zend OPcache - it was already loaded PHP Warning: Module 'mysqlnd' already loaded in Unknown on line 0 PHP Warning: Module 'PDO' already loaded in Unknown on line 0 PHP Warning: Module 'xml' already loaded in Unknown on line 0 PHP Warning: Module 'calendar' already loaded in Unknown on line 0 PHP Warning: Module 'ctype' already loaded in Unknown on line 0 PHP Warning: Module 'curl' already loaded in Unknown on line 0 PHP Warning: Module 'dom' already loaded in Unknown on line 0 PHP Warning: Module 'exif' already loaded in Unknown on line 0 PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0 PHP Warning: Module 'ftp' already loaded in Unknown on line 0 PHP Warning: Module 'gd' already loaded in Unknown on line 0 PHP Warning: Module 'gettext' already loaded in Unknown on line 0 PHP Warning: Module 'iconv' already loaded in Unknown on line 0 PHP Warning: Module 'json' already loaded in Unknown on line 0 PHP Warning: Module 'mbstring' already loaded in Unknown on line 0 PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0 PHP Warning: Module 'mysqli' already loaded in Unknown on line 0 PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0 PHP Warning: Module 'pdo_sqlite' already loaded in Unknown on line 0 PHP Warning: Module 'Phar' already loaded in Unknown on line 0 PHP Warning: Module 'posix' already loaded in Unknown on line 0 PHP Warning: Module 'readline' already loaded in Unknown on line 0 PHP Warning: Module 'shmop' already loaded in Unknown on line 0 PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0 PHP Warning: Module 'sockets' already loaded in Unknown on line 0 PHP Warning: Module 'sqlite3' already loaded in Unknown on line 0 PHP Warning: Module 'sysvmsg' already loaded in Unknown on line 0 PHP Warning: Module 'sysvsem' already loaded in Unknown on line 0 PHP Warning: Module 'sysvshm' already loaded in Unknown on line 0 PHP Warning: Module 'tokenizer' already loaded in Unknown on line 0 PHP Warning: Module 'wddx' already loaded in Unknown on line 0 PHP Warning: Module 'xmlreader' already loaded in Unknown on line 0 PHP Warning: Module 'xmlwriter' already loaded in Unknown on line 0 PHP Warning: Module 'xsl' already loaded in Unknown on line 0 PHP Warning: Module 'zip' already loaded in Unknown on line 0 > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache Cannot load Zend OPcache - it was already loaded PHP Warning: Module 'mysqlnd' already loaded in Unknown on line 0 PHP Warning: Module 'PDO' already loaded in Unknown on line 0 PHP Warning: Module 'xml' already loaded in Unknown on line 0 PHP Warning: Module 'calendar' already loaded in Unknown on line 0 PHP Warning: Module 'ctype' already loaded in Unknown on line 0 PHP Warning: Module 'curl' already loaded in Unknown on line 0 PHP Warning: Module 'dom' already loaded in Unknown on line 0 PHP Warning: Module 'exif' already loaded in Unknown on line 0 PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0 PHP Warning: Module 'ftp' already loaded in Unknown on line 0 PHP Warning: Module 'gd' already loaded in Unknown on line 0 PHP Warning: Module 'gettext' already loaded in Unknown on line 0 PHP Warning: Module 'iconv' already loaded in Unknown on line 0 PHP Warning: Module 'json' already loaded in Unknown on line 0 PHP Warning: Module 'mbstring' already loaded in Unknown on line 0 PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0 PHP Warning: Module 'mysqli' already loaded in Unknown on line 0 PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0 PHP Warning: Module 'pdo_sqlite' already loaded in Unknown on line 0 PHP Warning: Module 'Phar' already loaded in Unknown on line 0 PHP Warning: Module 'posix' already loaded in Unknown on line 0 PHP Warning: Module 'readline' already loaded in Unknown on line 0 PHP Warning: Module 'shmop' already loaded in Unknown on line 0 PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0 PHP Warning: Module 'sockets' already loaded in Unknown on line 0 PHP Warning: Module 'sqlite3' already loaded in Unknown on line 0 PHP Warning: Module 'sysvmsg' already loaded in Unknown on line 0 PHP Warning: Module 'sysvsem' already loaded in Unknown on line 0 PHP Warning: Module 'sysvshm' already loaded in Unknown on line 0 PHP Warning: Module 'tokenizer' already loaded in Unknown on line 0 PHP Warning: Module 'wddx' already loaded in Unknown on line 0 PHP Warning: Module 'xmlreader' already loaded in Unknown on line 0 PHP Warning: Module 'xmlwriter' already loaded in Unknown on line 0 PHP Warning: Module 'xsl' already loaded in Unknown on line 0 PHP Warning: Module 'zip' already loaded in Unknown on line 0 [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] Unable to parse file "/var/www/TestAPI/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/../Resources/config/web.xml". [InvalidArgumentException] The XML file "/var/www/TestAPI/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/../Resources/config/web.xml" is not valid. [Symfony\Component\Debug\Exception\ContextErrorException] Notice: Undefined property: DOMDocument::$documentElement Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception In ScriptHandler.php line 439: An error occurred when executing the "'cache:clear --no-warmup'" command: Cannot load Zend OPcache - it was already loaded PHP Warning: Module 'mysqlnd' already loaded in Unknown on line 0 PHP Warning: Module 'PDO' already loaded in Unknown on line 0 PHP Warning: Module 'xml' already loaded in Unknown on line 0 PHP Warning: Module 'calendar' already loaded in Unknown on line 0 PHP Warning: Module 'ctype' already loaded in Unknown on line 0 PHP Warning: Module 'curl' already loaded in Unknown on line 0 PHP Warning: Module 'dom' already loaded in Unknown on line 0 PHP Warning: Module 'exif' already loaded in Unknown on line 0 PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0 PHP Warning: Module 'ftp' already loaded in Unknown on line 0 PHP Warning: Module 'gd' already loaded in Unknown on line 0 PHP Warning: Module 'gettext' already loaded in Unknown on line 0 PHP Warning: Module 'iconv' already loaded in Unknown on line 0 PHP Warning: Module 'json' already loaded in Unknown on line 0 PHP Warning: Module 'mbstring' already loaded in Unknown on line 0 PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0 PHP Warning: Module 'mysqli' already loaded in Unknown on line 0 PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0 PHP Warning: Module 'pdo_sqlite' already loaded in Unknown on line 0 PHP Warning: Module 'Phar' already loaded in Unknown on line 0 PHP Warning: Module 'posix' already loaded in Unknown on line 0 PHP Warning: Module 'readline' already loaded in Unknown on line 0 PHP Warning: Module 'shmop' already loaded in Unknown on line 0 PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0 PHP Warning: Module 'sockets' already loaded in Unknown on line 0 PHP Warning: Module 'sqlite3' already loaded in Unknown on line 0 PHP Warning: Module 'sysvmsg' already loaded in Unknown on line 0 PHP Warning: Module 'sysvsem' already loaded in Unknown on line 0 PHP Warning: Module 'sysvshm' already loaded in Unknown on line 0 PHP Warning: Module 'tokenizer' already loaded in Unknown on line 0 PHP Warning: Module 'wddx' already loaded in Unknown on line 0 PHP Warning: Module 'xmlreader' already loaded in Unknown on line 0 PHP Warning: Module 'xmlwriter' already loaded in Unknown on line 0 PHP Warning: Module 'xsl' already loaded in Unknown on line 0 PHP Warning: Module 'zip' already loaded in Unknown on line 0 [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] Unable to parse file "/var/www/TestAPI/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/../Resources/config/web.xml". [InvalidArgumentException] The XML file "/var/www/TestAPI/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/../Resources/config/web.xml" is not valid. [Symfony\Component\Debug\Exception\ContextErrorException] Notice: Undefined property: DOMDocument::$documentElement ```

Le problème ce trouve dans le fichier ScriptHandler.php dans vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php'

Vous devez modifié (ligne 553):

if (false !== $ini = php_ini_loaded_file()) {
    $arguments[] = '--php-ini='.$ini;
}
PHP

par

if ($env = strval(getenv('COMPOSER_ORIGINAL_INIS'))) {
    $paths = explode(PATH_SEPARATOR, $env);
    $ini = array_shift($paths);
} else {
    $ini = php_ini_loaded_file();  
}
if (!empty($ini)) {
    $arguments[] = '--php-ini='.$ini;
} 
PHP

Une autre solution serait de passer sensio/distribution-bundle à la version 5.* mais c'est une autre histoire.

Lien vers l'issue Github


MarquandT

Ethical Hacker ~ Web Developper ~ Hosting Provider ~ Crypto Enthusiast ~ Automation Expert Bitcoin donation: 32Uu4NKGnxSPC7UukYXVyRHwbppbQpKVki

Comments

You must login to send a comment.