From 9c25633d6d88f08a67488bc50b9263e2b537cc43 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Wed, 2 Aug 2023 10:55:24 +0100 Subject: [PATCH] Set $_SERVER['SCRIPT_NAME'] within proxy command (#11562) --- src/Composer/Installer/BinaryInstaller.php | 5 +++++ .../Composer/Test/Installer/BinaryInstallerTest.php | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php index 43254af61..91479bf58 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -359,6 +359,11 @@ namespace Composer; $globalsCode $streamProxyCode + +if (__FILE__ === realpath(\$_SERVER['SCRIPT_NAME'])) { + \$_SERVER['SCRIPT_NAME'] = realpath($binPathExported); +} + return include $binPathExported; PROXY; diff --git a/tests/Composer/Test/Installer/BinaryInstallerTest.php b/tests/Composer/Test/Installer/BinaryInstallerTest.php index 8b6d47243..0fe971793 100644 --- a/tests/Composer/Test/Installer/BinaryInstallerTest.php +++ b/tests/Composer/Test/Installer/BinaryInstallerTest.php @@ -110,6 +110,18 @@ EOL [<<<'EOL' +