Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

IDProjectCategoryView StatusLast Update
0015275phpList 3 applicationHTML Email Supportpublic03-05-10 19:16
Reportermcfang Assigned To 
Status resolvedResolutionfixed 
Product Version2.10.9 
Fixed in Version2.10.10 
Summary0015275: stripHTML is too greedy when matching links
DescriptionIf your HTML has any A tags that do not have a HREF attribute then entire blocks of text are deleted.

A tags are most commonly used without HREF when providing anchor links within the content. eg: <a name="top"></a>

The problem is caused by a greedy match in function stripHTML (sendemaillib.php:1134)

$text = preg_replace("/<a.*href=[\"\'](.*)[\"\'][^>]*>(.*)<\/a>/Umis","[URLTEXT]\\2[ENDURLTEXT][LINK]\\1[ENDLINK]\n",$text);

If we replace the first greedy match with a saner match it will not be a problem:

$text = preg_replace("/<a[^>]*href=[\"\'](.*)[\"\'][^>]*>(.*)<\/a>/Umis","[URLTEXT]\\2[ENDURLTEXT][LINK]\\1[ENDLINK]\n",$text);
TagsNo tags attached.


related to 0015193 resolvedmichiel Portions of Content are Omitted in Plain Text from Plain Text Messages with <a> Tag 
related to 0009105 resolvedmichiel Anchors in HTML get converted to links in text mails 


There are no notes attached to this issue.