Skip to content

Commit d1f50c5

Browse files
committed
bug #16092 [Process] Throw exception if tempnam returns false (pierredup)
This PR was merged into the 2.7 branch. Discussion ---------- [Process] Throw exception if tempnam returns false | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15215 | License | MIT | Doc PR | Commits ------- cc854e6 Throw exception if tempnam returns false
2 parents 3e019c4 + cc854e6 commit d1f50c5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Symfony/Component/Process/Pipes/WindowsPipes.php

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

0 commit comments

Comments
 (0)