Problem/Motivation
If any other exception apart from an instance of TransportExceptionInterface when sending the email, a WSOD appears.
Steps to reproduce
Not sure how to reproduce this locally. For us it appears on platform.sh instances with outgoing emails disabled. For some reason then the transport method is switched to DSN which fails in \Symfony\Component\Mailer\Transport\Dsn::fromString with InvalidArgumentException.
I haven't investigated why it actually switches from SMTP (which is the default transport set by this module).
Proposed resolution
Add a fallback catch for \Exception
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | symfony_mailer_lite-handle-exception-3396902-2.patch | 731 bytes | primsi |
Comments
Comment #2
primsi commentedInitial patch
Comment #3
mxr576Just by reading the issue summary, I am unsure if this change is needed
InvalidArgumentException is an unchecked exception, it is meant to stop execution to protect the system, IOW cause WSOD.
https://phpstan.org/blog/bring-your-exceptions-under-control
Comment #5
zengenuity commented@Primsi, thanks for the patch. Committed.
@mxr576, I take your point about the exception stopping execution, but I think in this case, that's already happening, since we're at the very end of the mailing process, and we're returning FALSE to tell the rest of Drupal that it failed. I don't see any harm in triggering Drupal to display a nicely-formatted error message rather than crashing with a WSOD.