From 6b8f1409e4e7b5f70173104b4616be04050007aa Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Fri, 21 Jan 2022 14:52:39 +0100 Subject: [PATCH] report error if binary is a directory (#10463) file_exists is true also for directory and symlink. but later in generateUnixyProxyCode we call `file_get_contents` on the binary, which fails with `file_get_contents(): read of 8192 bytes failed with errno=21 Is a directory` if the binary is a directory. --- src/Composer/Installer/BinaryInstaller.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php index 1f6f14d78..7d5db0d2b 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -77,6 +77,10 @@ class BinaryInstaller $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package'); continue; } + if (is_dir($binPath)) { + $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': found a directory at that path'); + continue; + } if (!$this->filesystem->isAbsolutePath($binPath)) { // in case a custom installer returned a relative path for the // $package, we can now safely turn it into a absolute path (as we