Skip to content

Commit 1425b8a

Browse files
committed
Throw exception if tempnam returns false in ProcessPipes
1 parent 513fc31 commit 1425b8a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Symfony/Component/Process/ProcessPipes.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ public function __construct($useFiles, $ttyMode)
4444
// @see https://bugs.php.net/bug.php?id=51800
4545
if ($this->useFiles) {
4646
$this->files = array(
47-
Process::STDOUT => tempnam(sys_get_temp_dir(), 'sf_proc_stdout'),
48-
Process::STDERR => tempnam(sys_get_temp_dir(), 'sf_proc_stderr'),
47+
Process::STDOUT => tempnam(sys_get_temp_dir(), 'out_sf_proc'),
48+
Process::STDERR => tempnam(sys_get_temp_dir(), 'err_sf_proc'),
4949
);
5050
foreach ($this->files as $offset => $file) {
51-
$this->fileHandles[$offset] = fopen($this->files[$offset], 'rb');
52-
if (false === $this->fileHandles[$offset]) {
51+
if (false === $file || false === $this->fileHandles[$offset] = fopen($file, 'rb')) {
5352
throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
5453
}
5554
}

0 commit comments

Comments
 (0)