Project

General

Profile

Actions

Bug #103861

open

email addresses with special characters breaks email substitution

Added by Moritz Ngo about 1 month ago. Updated 30 days ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2024-05-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

When a email address with special characters is fed to \TYPO3\CMS\Frontend\Typolink\EmailLinkBuilder::processEmailLink(), the replacement won't work properly, due to a string mismatch.

TypoScript setup to reproduce:

config {
  spamProtectEmailAddresses = 4
  spamProtectEmailAddresses_atSubst = (at)
  spamProtectEmailAddresses_lastDotSubst = (dot)
}

page = PAGE
page {
  100 = TEXT
  100 {
    typolink.parameter = nomail@domain.com
    wrap = |<br>
  }

  200 = TEXT
  200 {
    typolink.parameter = no'mail@domain.com
    wrap = |<br>
  }
}

Expected Output:

<a href="#" data-mailto-token="qempxs.rs2qempDhsqemr2gsq" data-mailto-vector="4">no.mail(at)domain(dot)com</a><br>
<a href="#" data-mailto-token="qempxs.rs&#039;qempDhsqemr2gsq" data-mailto-vector="4">no&#039;mail@domain.com</a><br>

Actual Output:

<a href="#" data-mailto-token="qempxs.rs2qempDhsqemr2gsq" data-mailto-vector="4">no.mail(at)domain(dot)com</a><br>
<a href="#" data-mailto-token="qempxs.rs&#039;qempDhsqemr2gsq" data-mailto-vector="4">no&#039;mail(at)domain(dot)com</a><br>

My purposed solution is, to use htmlspecialchars when ultimately replacing $mailAddress of $linkText.

P.S.: Yeah I had to look it up, if/which special characters are even allowed in email addresses. The following post summarizes them quite good:
https://stackoverflow.com/a/2049510

Actions

Also available in: Atom PDF