8000 bug #59610 [Mailer] Ensure TransportExceptionInterface populates stre… · symfony/symfony@2f69270 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2f69270

Browse files
committed
bug #59610 [Mailer] Ensure TransportExceptionInterface populates stream debug data (bytestream)
This PR was merged into the 6.4 branch. Discussion ---------- [Mailer] Ensure TransportExceptionInterface populates stream debug data | Q | A | ------------- | --- | Branch? | 6.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT There is a discrepancy when `TransportExceptionInterface` is thrown. Sometimes `$e->getDebug()` is `''` and other times it contains information. Similarly, `$transport->getStream()->getDebug();` sometimes returns `''` because something else has already beaten you to the call... https://github.com/symfony/symfony/blob/05d5bb3b6a887c55b65d1247472d23e5dcbaa4f3/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php#L103 This results in you having to do something like the following to get the debug log... ``` } catch (TransportExceptionInterface $e) { $log = $e->getDebug() ?: $transport->getStream()->getDebug(); ``` This PR ensures that any `TransportExceptionInterface` thrown by `send()` sets the debug information. The notable case where this occurs is in `handleAuth` which is part of `start` (`doHeloCommand`). <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- 32a7d14 Ensure TransportExceptionInterface populates stream debug data
2 parents c09342e + 32a7d14 commit 2f69270

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ protected function doSend(SentMessage $message): void
205205
$this->ping();
206206
}
207207

208-
if (!$this->started) {
209-
$this->start();
210-
}
211-
212208
try {
209+
if (!$this->started) {
210+
$this->start();
211+
}
212+
213213
$envelope = $message->getEnvelope();
214214
$this->doMailFromCommand($envelope->getSender()->getEncodedAddress());
215215
foreach ($envelope->getRecipients() as $recipient) {

0 commit comments

Comments
 (0)
0