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

Skip to content

Commit ee18da7

Browse files
Ensure stream is cleaned before throwing transport exception
1 parent 5f8b42e commit ee18da7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/Mailer/Transport/Smtp/Stream/ProcessStream.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,15 @@ public function terminate(): void
5757
$err = stream_get_contents($this->err);
5858
fclose($this->err);
5959
if (0 !== $exitCode = proc_close($this->stream)) {
60-
throw new TransportException('Process failed with exit code '.$exitCode.': '.$out.$err);
60+
$errorMessage = 'Process failed with exit code '.$exitCode.': '.$out.$err;
6161
}
6262
}
6363

6464
parent::terminate();
65+
66+
if (isset($errorMessage)) {
67+
throw new TransportException($errorMessage);
68+
}
6569
}
6670

6771
protected function getReadConnectionDescription(): string

0 commit comments

Comments
 (0)