diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php index 0a7b97149..3ffbb50b3 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -191,6 +191,42 @@ class BinaryInstaller $binDir = ProcessExecutor::escape(dirname($binPath)); $binFile = basename($binPath); + $binContents = file_get_contents($bin); + if (preg_match('{^(?:#!(?:/usr)?/bin/env php|#!(?:/usr)?/bin/php| var_export(\$binPath, true), + '__DIR__' => var_export(dirname(\$binPath), true), + )); + + eval(\$contents); + exit(0); +} +include \$binPath; + +PROXY; + } + $proxyCode = <<