I see this error while jumping into code base which use Zend Framework 1 and running composer install (php 5.6, composer 1.2.2):
[ErrorException]
ZipArchive::extractTo(C:\Users\░░░░░\Documents\GitHub\░░░░-web-app\░░░░-zf/vendor/composer/242a794b/ZendFramework-1
.12.░░\library\Zend\Service\WindowsAzure\CommandLine\Scaffolders\DefaultScaffolder\resources\PhpOnAzure.Web\resourc
es\WebPICmdLine/Microsoft.Web.PlatformInstaller.dll): failed to open stream: Invalid argument
Found helpful comment on the related GitHub issue:
Apparently composer will sometimes tell you the path length is too long,
other times it won’t.
The most common recommendation is to runcomposer install --prefer-sourceto omit calling ZipArchiveat all. But I can’t do that because project configuration has pinned zipped source:
{
"type": "package",
"package": {
"name": "░░░░/zf1",
"version": "1.12.░░",
"dist": {
"url": "https://packages.zendframework.com/releases/ZendFramework-1.12.░░/ZendFramework-1.12.░░.zip",
"type": "zip"
},
"autoload": {
"psr-0": {
"Zend_": "library/"
}
},
"include-path": [
"library/"
],
"config": {
"bin-dir": "bin"
}
}
},
If path is too long for Windows, I’ll run unix on top.
Git Bash won’t help
I’ve tried to run composer install with Git Bash, but it shows the same error. So I can assume that this error is bound with system or php version, or their interaction.
Ubuntu via Vargant is going to help
I’ve tried a fast workaround with vargrant which worked well. Configuration file inside folder with composer.json:
# -*- mode: ruby -*-
# vi: set ft=ruby :Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
end
Running from Git Bash to have ssh without dealing with Putty keys:
vagrant up
vagrant ssh
sudo php install # installs php7.0
cd /vagrant
php composer.phar install --ignore-platform-reqs
It was crucial to add --ignore-platform-reqs so composer could install dependencies with only default php extensions installed.
Simple solution is to use php 7.1
The last step is to remove all that installation complexity for a future team members. Updating composer to a current stable 1.4.2 version won’t help.
But there is a comment that it’s fixed with php7.1:
This is no longer an issue with PHP 7.1. 🎉
And yes! It works without any problems. Record was added into the internal wiki and investigation closed.
