1
0
Fork 0

Fix binary proxies having an absolute path to vendor dir when project dir is a symlink, fixes #11947

pull/11963/head
Jordi Boggiano 2024-04-29 11:32:47 +02:00
parent 80631d2fc8
commit d4396a85bf
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 6 additions and 1 deletions

View File

@ -225,7 +225,12 @@ class BinaryInstaller
$phpunitHack1 = $phpunitHack2 = '';
// Don't expose autoload path when vendor dir was not set in custom installers
if ($this->vendorDir) {
$globalsCode .= '$GLOBALS[\'_composer_autoload_path\'] = ' . $this->filesystem->findShortestPathCode($link, $this->vendorDir . '/autoload.php', false, true).";\n";
// ensure comparisons work accurately if the CWD is a symlink, as $link is realpath'd already
$vendorDirReal = realpath($this->vendorDir);
if ($vendorDirReal === false) {
$vendorDirReal = $this->vendorDir;
}
$globalsCode .= '$GLOBALS[\'_composer_autoload_path\'] = ' . $this->filesystem->findShortestPathCode($link, $vendorDirReal . '/autoload.php', false, true).";\n";
}
// Add workaround for PHPUnit process isolation
if ($this->filesystem->normalizePath($bin) === $this->filesystem->normalizePath($this->vendorDir.'/phpunit/phpunit/phpunit')) {