Pending

User tests: Successful: Unsuccessful:

avatar ManoharPaturi
ManoharPaturi
4 Oct 2026

Pull Request resolves #

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

MailHelper::cleanText() removes line breaks followed by a mail header name from multi line input and is used by Mail::setBody(). Two gaps exist in the current pattern:

  1. The line break part matches once, so a CRLF sequence leaves its CR behind: "test\r\nto:me" becomes "test\rme" instead of "testme". The data provider of the existing unit test already contains commented rows for these cases, marked with @TODO Should this be included.
  2. Only content-type:, to:, cc: and bcc: are covered, while the sibling methods cleanBody() and cleanSubject() also filter From: and Subject:. A body line such as "test\r\nreply-to:me" passes through completely unfiltered.

This PR makes the line break part repeatable so the full CRLF or repeated encoded breaks are consumed, and extends the header list with from:, subject: and reply-to:. The commented rows in the data provider are enabled and rows for the added header names and the mixed %0A%0D form are supplied. Fifteen provider rows fail against the previous implementation.

The scope is deliberately the same as before: only a line break directly followed by one of the known header names is removed from mail input.

Testing Instructions

Run the mail helper unit tests:

libraries/vendor/bin/phpunit tests/Unit/Libraries/Cms/Mail/MailHelperTest.php

The complete mail test directory passes with the change:

libraries/vendor/bin/phpunit tests/Unit/Libraries/Cms/Mail

Actual result BEFORE applying this Pull Request

MailHelper::cleanText("test\r\nto:me") returns "test\rme" and MailHelper::cleanText("test\r\nreply-to:me") returns the input unchanged.

Expected result AFTER applying this Pull Request

Both inputs return "testme".

Link to documentations

  • No documentation changes for guide.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar ManoharPaturi ManoharPaturi - open - 4 Oct 2026
avatar ManoharPaturi ManoharPaturi - change - 4 Oct 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Oct 2026
Category ⇒ Libraries Unit Tests

Add a Comment

Login with GitHub to post a comment