Skip to content

Commit

Permalink
Fix PHP Notices 'Only variables should be passed by reference' in Sen…
Browse files Browse the repository at this point in the history
…dmailThrottle message logging

preparing for 1.0.4 release
  • Loading branch information
onlime committed Oct 18, 2019
1 parent 8dbdfba commit e57864b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 1.0.4 (2019-10-18)

- Ensure auto_prepend_file (prepend.php) is not loaded in sendmail-wrapper as it would override the passed env vars
- Fix PHP Notices 'Only variables should be passed by reference' in SendmailThrottle message logging

## 1.0.3 (2019-10-14)

- Fix for PHP setup where extensions are not compiled-in, loaded as modules. Standard php.ini is now loaded. fixes #1, #4
Expand Down
15 changes: 10 additions & 5 deletions app/SendmailThrottle.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ public function run($username, $rcptCount)
protected function _logMessage($throttleId, $username, $rcptCount, $status)
{
$headerArr = $this->getParsedHeaderArr();
$from = mb_decode_mimeheader($headerArr['from'] ?? null);
$to = mb_decode_mimeheader($headerArr['to'] ?? null);
$cc = mb_decode_mimeheader($headerArr['cc'] ?? null);
$bcc = mb_decode_mimeheader($headerArr['bcc'] ?? null);
$subject = mb_decode_mimeheader($headerArr['subject'] ?? null);

$sql = 'INSERT INTO messages (throttle_id, username, uid, gid, rcpt_count, status, msgid, from_addr, to_addr,
cc_addr, bcc_addr, subject, site, client, script)
Expand All @@ -212,11 +217,11 @@ protected function _logMessage($throttleId, $username, $rcptCount, $status)
$stmt->bindParam(':rcptCount' , $rcptCount);
$stmt->bindParam(':status' , $status);
$stmt->bindParam(':msgid' , $headerArr['x-meta-msgid']);
$stmt->bindParam(':fromAddr' , mb_decode_mimeheader($headerArr['from']));
$stmt->bindParam(':toAddr' , mb_decode_mimeheader($headerArr['to']));
$stmt->bindParam(':ccAddr' , mb_decode_mimeheader($headerArr['cc']));
$stmt->bindParam(':bccAddr' , mb_decode_mimeheader($headerArr['bcc']));
$stmt->bindParam(':subject' , mb_decode_mimeheader($headerArr['subject']));
$stmt->bindParam(':fromAddr' , $from);
$stmt->bindParam(':toAddr' , $to);
$stmt->bindParam(':ccAddr' , $cc);
$stmt->bindParam(':bccAddr' , $bcc);
$stmt->bindParam(':subject' , $subject);
$stmt->bindParam(':site' , $headerArr['x-meta-site']);
$stmt->bindParam(':client' , $headerArr['x-meta-client']);
$stmt->bindParam(':script' , $headerArr['x-meta-script']);
Expand Down

0 comments on commit e57864b

Please sign in to comment.