PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail_Mime » Bug #4297

HTML background image name not replaced

Details

Request #4297HTML background image name not replaced
Submitted2005-05-06 16:30 UTC
Fromphp at bicou dot com
Assignedcipri
StatusClosed
PackageMail_Mime
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2005-05-06 16:30 UTC] php at bicou dot com

Description:
------------
In the HTML part of a message, the background attribute value is not correctly replaced with the cid of the inlined image. This affects ThunderBird HTML rendering.
Patch attached.

Reproduce code:
---------------
$ cat Mail_Mime-html_background_image.diff
--- Mail/mime.php.orig 2005-05-06 18:20:56.000000000 +0200
+++ Mail/mime.php 2005-05-06 18:21:36.000000000 +0200
@@ -460,9 +460,9 @@

if (!empty($this->_html_images) AND isset($this->_htmlbody)) {
foreach ($this->_html_images as $value) {
- $regex = '#src\s*=\s*(["\']?)' . preg_quote($value['name']) .
+ $regex = '#(src|background)\s*=\s*(["\']?)' . preg_quote($value['name']) .
'(["\'])?#';
- $rep = 'src=\1cid:' . $value['cid'] .'\2';
+ $rep = '\1=\2cid:' . $value['cid'] .'\3';
$this->_htmlbody = preg_replace($regex, $rep,
$this->_htmlbody
);