Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto generated subjects no longer seem to be functioning #1479

Closed
Sammaye opened this issue Jul 2, 2020 · 2 comments
Closed

Auto generated subjects no longer seem to be functioning #1479

Sammaye opened this issue Jul 2, 2020 · 2 comments
Labels
Milestone

Comments

@Sammaye
Copy link

Sammaye commented Jul 2, 2020

Monolog version 2

I use the swift mail handler in my Laravel app and I started to notice recently that monolog handler was raising an error within itself when trying to pipe out to emails, like so:

PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Monolog\Handler\SwiftMailerHandler::getSubjectFormatter() must be of the type string, null given, called in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php on line 84 and defined in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php:57
Stack trace:
#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php(84): Monolog\Handler\SwiftMailerHandler->getSubjectFormatter(NULL)
#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php(49): Monolog\Handler\SwiftMailerHandler->buildMessage('<h1 style="back...', Array)
#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php(56): Monolog\Handler\SwiftMailerHandler->send('<h1 style="back...', Array)
#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(42): Monolog\Handl

I have been doing some extra investigation into this, finding that something has changed in recent versions of monolog which means that now I must explicitly put the subject into the message that I send into the handler.

This is a bit annoying since I want a subject based on the error contents, is this intentional and if not is there a way to replicate this functionality in newer versions?

@Sammaye Sammaye added the Support label Jul 2, 2020
@Sammaye
Copy link
Author

Sammaye commented Jul 2, 2020

As an example this is what the exact same code I use looks under older versions of monolog
Annotation 2020-07-02 172035

@Seldaek
Copy link
Owner

Seldaek commented Jul 8, 2020

I think this was a mistake, the fact that the subject might be left out was not really taken into consideration. Will fix.

@Seldaek Seldaek added this to the 2.x milestone Jul 8, 2020
@Seldaek Seldaek closed this as completed in 1eafcbf Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants