[Process] In edge cases getcwd() can return false, then proc_open() should get null to use default value (the working dir of the current PHP process)

This commit is contained in:
Joseph Bielawski 2013-01-08 13:27:17 +01:00
parent 835c1b8615
commit 880da01c49

View File

@ -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;
}