PHP: Fatal error when build docker image with composer
I saw this news about the serious vulnerability in composer which is PHP package management software.
https://www.bankinfosecurity.com/php-composer-flaw-that-could-affect-millions-sites-patched-a-16523
So, I wanted to update composer in my Dockerfile but I realized that I already specified the version as follows.
1curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer --version=1.10.16
Because it was a workaround for an error related to hirak/prestissimo which I did before. So, I deleted it and built the Docker image again but I got a different error as follows.
1#14 281.5 122/122 [============================] 100% - Installing kylekatarnls/update-helper (1.2.0): Extracting archive
2#14 281.5
3#14 281.5 Fatal error: Class UpdateHelper\ComposerPlugin contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in …
It looks some problem about kylekatarnls/update-helper library. So, I searched about the library and I found a clue on GitHub.
https://github.com/kylekatarnls/update-helper/issues/7
So, I deleted composer.lock file and built the image again. Then the problem was solved. The above page said I need to delete the ‘vendor’ directory but it’s not necessary for docker build because it will be generated newly.