Skip to content

Commit e57864b

Browse files
committed
Fix PHP Notices 'Only variables should be passed by reference' in SendmailThrottle message logging
preparing for 1.0.4 release
1 parent 8dbdfba commit e57864b

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 1.0.4 (2019-10-18)
4+
5+
- Ensure auto_prepend_file (prepend.php) is not loaded in sendmail-wrapper as it would override the passed env vars
6+
- Fix PHP Notices 'Only variables should be passed by reference' in SendmailThrottle message logging
7+
38
## 1.0.3 (2019-10-14)
49

510
- Fix for PHP setup where extensions are not compiled-in, loaded as modules. Standard php.ini is now loaded. fixes #1, #4

app/SendmailThrottle.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ public function run($username, $rcptCount)
199199
protected function _logMessage($throttleId, $username, $rcptCount, $status)
200200
{
201201
$headerArr = $this->getParsedHeaderArr();
202+
$from = mb_decode_mimeheader($headerArr['from'] ?? null);
203+
$to = mb_decode_mimeheader($headerArr['to'] ?? null);
204+
$cc = mb_decode_mimeheader($headerArr['cc'] ?? null);
205+
$bcc = mb_decode_mimeheader($headerArr['bcc'] ?? null);
206+
$subject = mb_decode_mimeheader($headerArr['subject'] ?? null);
202207

203208
$sql = 'INSERT INTO messages (throttle_id, username, uid, gid, rcpt_count, status, msgid, from_addr, to_addr,
204209
cc_addr, bcc_addr, subject, site, client, script)
@@ -212,11 +217,11 @@ protected function _logMessage($throttleId, $username, $rcptCount, $status)
212217
$stmt->bindParam(':rcptCount' , $rcptCount);
213218
$stmt->bindParam(':status' , $status);
214219
$stmt->bindParam(':msgid' , $headerArr['x-meta-msgid']);
215-
$stmt->bindParam(':fromAddr' , mb_decode_mimeheader($headerArr['from']));
216-
$stmt->bindParam(':toAddr' , mb_decode_mimeheader($headerArr['to']));
217-
$stmt->bindParam(':ccAddr' , mb_decode_mimeheader($headerArr['cc']));
218-
$stmt->bindParam(':bccAddr' , mb_decode_mimeheader($headerArr['bcc']));
219-
$stmt->bindParam(':subject' , mb_decode_mimeheader($headerArr['subject']));
220+
$stmt->bindParam(':fromAddr' , $from);
221+
$stmt->bindParam(':toAddr' , $to);
222+
$stmt->bindParam(':ccAddr' , $cc);
223+
$stmt->bindParam(':bccAddr' , $bcc);
224+
$stmt->bindParam(':subject' , $subject);
220225
$stmt->bindParam(':site' , $headerArr['x-meta-site']);
221226
$stmt->bindParam(':client' , $headerArr['x-meta-client']);
222227
$stmt->bindParam(':script' , $headerArr['x-meta-script']);

0 commit comments

Comments
 (0)