composer-patches
composer-patches copied to clipboard
file_put_contents for PATCHES.txt fails
Since today I've problems with applying patches when I install packages with composer for new projects. The install command fails with the following error:
[ErrorException]
file_put_contents(typo3/cms-cli/PATCHES.txt): failed to open stream: No such file or directory
The patches themself are applied, but composer exits with an error
- Applying patches for typo3/cms-cli
https://github.com/TYPO3/cms-cli/compare/master...Bartacus:patch/2.0.0/bartacus-entry-script.patch (Patch entry point for proper Symfony kernel bootstrap)
- Applying patches for typo3/cms-core
https://github.com/TYPO3/TYPO3.CMS/compare/v10.4.1...Bartacus:patch/10.4/core/bartacus-entry-script.patch (Patch TYPO3 entry point for proper Symfony kernel bootstrap)
https://github.com/TYPO3/TYPO3.CMS/compare/v10.4.1...Bartacus:patch/10.4/core/psr7-compliance.patch (Make TYPO3 own PSR-7 implementation really compliant)
https://github.com/TYPO3/TYPO3.CMS/compare/v10.4.1...Bartacus:patch/10.4/core/platformsh-writeable-localconfiguration.patch (Use platform.sh setup specific dir on LocalConfiguration.php write check)
- Applying patches for typo3/cms-frontend
https://github.com/TYPO3/TYPO3.CMS/compare/v10.4.1...Bartacus:patch/10.4/frontend/bartacus-entry-script.patch (Patch TYPO3 entry point for proper Symfony kernel bootstrap)
- Applying patches for typo3/cms-install
https://github.com/TYPO3/TYPO3.CMS/compare/v10.4.1...Bartacus:patch/10.4/install/bartacus-entry-script.patch (Patch TYPO3 entry point for proper Symfony kernel bootstrap)
https://github.com/TYPO3/TYPO3.CMS/compare/v10.4.1...Bartacus:patch/10.4/install/platformsh-fixfolderstructure.patch (Never throw an exception if file/folder permissions are already correct)
https://github.com/TYPO3/TYPO3.CMS/compare/v10.4.1...Bartacus:patch/10.4/install/platformsh-enablefile.patch (Resolve writeable symlinks to ENABLE_INSTALL_TOOL and FIRST_INSTALL file)
- Applying patches for typo3/cms-backend
https://github.com/TYPO3/TYPO3.CMS/compare/v10.4.1...Bartacus:patch/10.4/backend/bartacus-entry-script.patch (Patch TYPO3 entry point for proper Symfony kernel bootstrap)
- Applying patches for helhum/typo3-console
https://github.com/Bartacus/TYPO3-Console/compare/v6.1.0...patch/6.1/bartacus-entry-script.patch (Patch console entry script for proper Symfony kernel bootstrap)
These patches are part of two composer package we are installing in our main project
- https://github.com/Bartacus/BartacusBundle/blob/master/composer.json
- https://github.com/Bartacus/BartacusPlatformshBundle/blob/master/composer.json
Seems to be an issue with a release of the following package: https://github.com/symfony/flex/
Everything is good with version 1.10.0
, newer versions produces the error
This Issue persists with symfony/flex
version 1.10.0
aswell for me.
The problem seems to occur when symfony/flex
is listed as a dependency in the composer.json. The flex plugin adds a NoopInstaller
here. When the composer-patches plugin runs, it gets this NoopInstaller
from the composer InstallationManager
instead of the correct LibraryInstaller
. The NoopInstaller
returns a bad path (basically only returning the package name instead of the realpath to the vendor folder plus package name) which seems to not be handled correctly in this package.
This problem only occurs on the first composer install
since the patches get correctly applied. The composer-patches postInstall hook seems to run twice and only the second time gets the NoopInstaller
added by symfony/flex
.
This could possibly be prevented if a check for the correct installer is added before executing the patches and writing the report files.
Getting the same error on a WP (Bedrock) installation : No flex involved.
This functionality doesn't exist in main
anymore. In 1.x, you can disable patch reporting