Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af2768c

Browse files
committed
bug #16111 Throw exception if tempnam returns false in ProcessPipes (pierredup)
This PR was merged into the 2.3 branch. Discussion ---------- Throw exception if tempnam returns false in ProcessPipes | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15215 | License | MIT | Doc PR | Related to #16092 Commits ------- 1425b8a Throw exception if tempnam returns false in ProcessPipes
2 parents ad2e85e + 1425b8a commit af2768c

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)