1
0
Fork 0

Set $_SERVER['SCRIPT_NAME'] within proxy command (#11562)

pull/11581/head
Dan Wallis 2023-08-02 10:55:24 +01:00 committed by GitHub
parent f4738d97b7
commit 9c25633d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -359,6 +359,11 @@ namespace Composer;
$globalsCode $globalsCode
$streamProxyCode $streamProxyCode
if (__FILE__ === realpath(\$_SERVER['SCRIPT_NAME'])) {
\$_SERVER['SCRIPT_NAME'] = realpath($binPathExported);
}
return include $binPathExported; return include $binPathExported;
PROXY; PROXY;

View File

@ -110,6 +110,18 @@ EOL
<?php declare(strict_types=1); <?php declare(strict_types=1);
echo 'success '.$_SERVER['argv'][1]; echo 'success '.$_SERVER['argv'][1];
EOL
],
'php file which validates $_SERVER["SCRIPT_NAME"]' => [<<<'EOL'
<?php
if (__FILE__ === realpath($_SERVER['SCRIPT_NAME'])) {
echo 'success '.$_SERVER['argv'][1];
} else {
fwrite(STDERR, "Test failure: __FILE__ does not match \$_SERVER['SCRIPT_NAME']\n");
fwrite(STDERR, "\t__FILE__:\t" . __FILE__ . "\n");
fwrite(STDERR, "\t\$_SERVER['SCRIPT_NAME']:\t" . $_SERVER['SCRIPT_NAME'] . "\n");
exit(1);
}
EOL EOL
], ],
]; ];