When I step debug EnvExampleStep::run() I see that $source already contains the absolute path /var/www/templates/.env.example. But it seems that $paths->root() expect a relative path and returns /var/www/var/www/templates/.env.example which causes realpath() to return false of course.
public function run(Config $config, Paths $paths): int
{
/** @var string|bool $source */
$source = $this->config[Config::ENV_EXAMPLE]->unwrapOrFallback(false);
if (!$source) {
return Step::NONE;
}
$destination = $this->targetPath($paths);
if (is_string($source) && filter_var($source, FILTER_VALIDATE_URL)) {
return $this->download($source, $destination);
}
$isAsk = $source === OptionalStep::ASK;
if (!$isAsk && is_string($source)) {
$realpath = realpath($paths->root($source));
if (!$realpath) {
$this->error = "{$source} is not a valid valid relative path to env-example file.";
return Step::ERROR;
}
return $this->copy($paths, $destination, $realpath);
}
return $this->copy($paths, $destination);
}
Expected behavior
I would expect that templates/.env.example to .env.
Describe the bug When I run
composer install
I see WPStarter responding with an error message:To Reproduce I'm using wpstarter at dev-version-3 constraint so basically the latest development version.
This is my wpstarter config in composer.json:
When I step debug
EnvExampleStep::run()
I see that$source
already contains the absolute path/var/www/templates/.env.example
. But it seems that$paths->root()
expect a relative path and returns/var/www/var/www/templates/.env.example
which causesrealpath()
to return false of course.Expected behavior I would expect that
templates/.env.example
to.env
.