diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 7c6d135534..cf553ee11a 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -53,7 +53,7 @@ class Process } $this->commandline = $commandline; - $this->cwd = null === $cwd ? getcwd() : $cwd; + $this->cwd = $cwd; if (null !== $env) { $this->env = array(); foreach ($env as $key => $value) { @@ -359,6 +359,13 @@ class Process */ public function getWorkingDirectory() { + // This is for BC only + if (null === $this->cwd) { + // getcwd() will return false if any one of the parent directories does not have + // the readable or search mode set, even if the current directory does + return getcwd() ?: null; + } + return $this->cwd; }