Search code examples
phpcomposer-phppear

Does using Composer to install PEAR packages work in PHP 7?


In PHP 5.5 using Composer to install a PEAR package works fine (of course). I've set up a PHP 7 test box to see if our unit tests will pass under PHP 7 and the immediate issue I've run into is that the PEAR dependencies do not work:

Loading composer repositories with package information
Initializing PEAR repository https://pear.php.net
Updating dependencies (including require-dev)
  - Installing packagist/closurecompiler-bin (dev-master d52231c)
    Cloning d52231c49813347010fa605d0f102ada68bb8b4b

  - Installing pear-pear.php.net/structures_graph (1.1.1)
    Loading from cache



  [UnexpectedValueException]
  Failed to extract PEAR package /opt/navigate/vendor/pear-pear.php.net/Structures_Graph/Structures_Graph-1.1.1.tgz to /opt/navigate/vendor/pear-pear.php.net/Structures_Graph. Reason: phar error: tar-base
  d phar "Structures_Graph-1.1.1/tests/BasicGraphTest.php" cannot be registered






  [UnexpectedValueException]
  phar error: tar-based phar "Structures_Graph-1.1.1/tests/BasicGraphTest.php" cannot be registered

I cannot figure this one out - it seems to be an out and out PHP 7 incompatibility that no-one's writing about on the net?


Solution

  • The bug was caused by tar files containing duplicate filenames, it has been fixed in php 7.0.5. In 5.5 and 5.6 the same bug existed, however here it "only" caused a memoryleak as the code change in php7 only checked for an invalid return value isn't applied to php 5.5 or 5.6. The memoryleak has also been addressed in php 5.6.20 in the same manor as in php 7.0.5.