Skip to content

Commit a99e784

Browse files
authored
Merge pull request #120 from inpsyde/fix/phpmailer-race-condition
Hardcode PHPMailer\SMTP values to avoid race conditions due to early …
2 parents 911dda2 + 8f8bf57 commit a99e784

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/HookListener/MailerListener.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ class MailerListener implements ActionListener
2222
/**
2323
* @param int $errorLogLevel
2424
* @param int $smtpDebugLevel
25+
* @see PHPMailer\SMTP
2526
*/
2627
public function __construct(
2728
int $errorLogLevel = LogLevel::ERROR,
28-
int $smtpDebugLevel = PHPMailer\SMTP::DEBUG_SERVER,
29+
int $smtpDebugLevel = 2, // PHPMailer\SMTP::DEBUG_SERVER - hardcoded to avoid race conditions
2930
) {
3031

3132
$this->errorLogLevel = LogLevel::normalizeLevel($errorLogLevel) ?? LogLevel::ERROR;
33+
3234
$this->smtpDebugLevel = min(
33-
max(PHPMailer\SMTP::DEBUG_OFF, $smtpDebugLevel),
34-
PHPMailer\SMTP::DEBUG_LOWLEVEL
35+
max(0, $smtpDebugLevel), // 0 = PHPMailer\SMTP::DEBUG_OFF
36+
4 // 4 = PHPMailer\SMTP::DEBUG_LOWLEVEL
3537
);
3638
}
3739

0 commit comments

Comments
 (0)