PHP Classes

CR/LF is not stripped

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  CR/LF is not stripped  >  (Un) Subscribe thread alerts  
Subject:CR/LF is not stripped
Summary:CR/LF is not stripped from the end of decoded bodies
Messages:2
Author:Kieran
Date:2023-04-12 13:36:15
 

  1. CR/LF is not stripped   Reply   Report abuse  
Picture of Kieran Kieran - 2023-04-12 13:36:15
I believe there is a bug in the phpclasses mimeparser where a rogue carriage return / line feed is added to the end of every decoded body. It comes from the mime structure, but shouldn't be present in the decoded body. For example:

Failed asserting that two strings are identical.
Expected :'"Dear,"'
Actual :'"Dear,\n"'

Failed asserting that two strings are identical.
Expected :'"<html><body>Dear,<\/body><\/html>"'
Actual :'"<html><body>Dear,<\/body><\/html>\n"'

Failed asserting that two strings are identical.
Expected :'"9801855875A5D50DE372AA3C469C1B8C8933B70E2B8612EE90B4F7DF8290CDDABB8DA560970F185A37459CD13BC9B89B64F87D45ADEAD235509ABD5DC0ADD"'
Actual :'"9801855875A5D50DE372AA3C469C1B8C8933B70E2B8612EE90B4F7DF8290CDDABB8DA560970F185A37459CD13BC9B89B64F87D45ADEAD235509ABD5DC0ADD\n"'

In each case you can see a trailing \n which is part of the mime structure is being added to the decoded body. It's not really a concern for text, but for attachments it changes the number of expected bytes in the file.

@Manuel I've emailed you a test case.

  2. Re: CR/LF is not stripped   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2023-04-12 18:48:40 - In reply to message 1 from Kieran
Thank you for reporting.

I will get back to you after I analyze this case, probably this weekend.

Please be patient.