-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.3.5
-
MOODLE_403_STABLE
Description:
There is a bug when sending unformatted text emails if the format_text_email() function is called first, followed by email_to_user(). Both functions invoke html_to_text(), leading to issues with certain email content.
Steps to Reproduce:
Set the user's email preference (mailformat) to "unformatted text".
Enable email notifications for forum posts and set it to "no digest".
Create a forum post with the content "aaa <:bbb" (without a space between <: and bbb).
Enable: "Send forum post notifications with no editing-time delay"
Please note: i switched the semicolon in <: to a colon to prevent it beeing interpreted as <
Expected Result:
The email should be sent with the content "aaa <bbb".
Actual Result:
The email is sent with the content "aaa ". The first invocation of html_to_text() converts the message to "aaa <bbb". The second invocation misinterprets the "<" character as the beginning of an HTML tag, leading to the truncation of the message.
Details:
The double invocation occurs in in send_user_notifications.php as follows:
1. renderer_textemail.php -> format_message_text() → format_text_email() -> html_to_text()
2. message_send() → send_message() → send_message_to_processors() → call_processors() (in message_output_email.php) → email_to_user() → html_to_text()