largersmallernormaltext version of this page

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0015275 [phplist] HTML Email Support major always 04-05-09 12:11 04-05-09 14:03
Reporter mcfang View Status public  
Assigned To
Priority normal Resolution fixed  
Status resolved   Product Version 2.10.9
Summary 0015275: stripHTML is too greedy when matching links
Description If 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);
Additional Information
Tags No tags attached.
Attached Files

- Relationships

There are no notes attached to this issue.


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker