Skip to content

Commit

Permalink
Fix handling of missing HOME env, fixes composer#10670
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek authored and emahorvat52 committed Jan 18, 2023
1 parent ddf175c commit 3670cb6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Composer/Config.php
Expand Up @@ -369,9 +369,7 @@ public function get(string $key, int $flags = 0)
return (int) $this->config['cache-ttl'];

case 'home':
$val = Preg::replace('#^(\$HOME|~)(/|$)#', rtrim(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE'), '/\\') . '/', $this->config[$key]);

return rtrim($this->process($val, $flags), '/\\');
return rtrim($this->process(Platform::expandPath($this->config[$key]), $flags), '/\\');

case 'bin-compat':
$value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
Expand Down

0 comments on commit 3670cb6

Please sign in to comment.