From 0efd0e460f19a39c6dd47dcd6c2e0162dd2c36aa Mon Sep 17 00:00:00 2001 From: Dylan Wagstaff Date: Mon, 25 Nov 2019 19:05:34 +1300 Subject: [PATCH] FIX Unset parent mime part body, not just children The message itself is a MimePart, where the PGP signer will set the contents as children (and clear existing ones), it wrongly did not unset the body - meaning that a message as a single body was to be transmitted as plain text as the message body, then also encrypted as an attachemnt. This made PGP encryption pointeless, and is a rather glaring bug. --- lib/SwiftSignerCryptGPG.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/SwiftSignerCryptGPG.php b/lib/SwiftSignerCryptGPG.php index 48e8f43..a236e5f 100644 --- a/lib/SwiftSignerCryptGPG.php +++ b/lib/SwiftSignerCryptGPG.php @@ -87,6 +87,7 @@ public function signMessage(Swift_Message $message) // Prepare message final form $message ->setEncoder($encoder) + ->setBody(null) ->setChildren([$pgpmime, $encryptedMessage]); $type = $message->getHeaders()->get('Content-Type');