Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 227d166

Browse filesBrowse files
committed
[Mailer] Fix sendmail transport not handling failure
1 parent 359d59e commit 227d166
Copy full SHA for 227d166

File tree

2 files changed

+10
-2
lines changed
Filter options

2 files changed

+10
-2
lines changed

‎src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ abstract class AbstractStream
2727
protected $stream;
2828
protected $in;
2929
protected $out;
30+
protected $err;
3031

3132
private $debug = '';
3233

@@ -65,7 +66,7 @@ abstract public function initialize(): void;
6566

6667
public function terminate(): void
6768
{
68-
$this->stream = $this->out = $this->in = null;
69+
$this->stream = $this->err = $this->out = $this->in = null;
6970
}
7071

7172
public function readLine(): string

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Transport/Smtp/Stream/ProcessStream.php
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,21 @@ public function initialize(): void
4545
}
4646
$this->in = &$pipes[0];
4747
$this->out = &$pipes[1];
48+
$this->err = &$pipes[2];
4849
}
4950

5051
public function terminate(): void
5152
{
5253
if (null !== $this->stream) {
5354
fclose($this->in);
55+
$out = stream_get_contents($this->out);
5456
fclose($this->out);
55-
proc_close($this->stream);
57+
$err = stream_get_contents($this->err);
58+
fclose($this->err);
59+
$exitCode = proc_close($this->stream);
60+
if (0 !== $exitCode) {
61+
throw new TransportException('Process failed with exit code '.$exitCode.': '.$out.$err);
62+
}
5663
}
5764

5865
parent::terminate();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.