Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is problem in file mailmime.inc with extending Mail_mime class from https://raw.githubusercontent.com/pear/Mail_Mime/master/Mail/mime.php - current class realization does not has the _htmlBody property, but this property is using in the get method.
public function &get($params = NULL, $filename = NULL, $skip_head = FALSE) {
if (isset($this->_htmlbody)) {
$this->_htmlbody = preg_replace_callback(
array(
...
),
array(&$this, 'attachRegex'),
$this->_htmlbody
);
}
return self::successful(
parent::get($params, $filename, $skip_head)
);
}
The good news is that class has two interface functions - getHTMLBody and setHTMLBody, so we just need to use them instead of protected property (which now is called simply htmlBody).
public function &get($params = NULL, $filename = NULL, $skip_head = FALSE) {
$sBody = $this->getHTMLBody();
if (!is_null($sBody)) {
$this->setHTMLBody(
preg_replace_callback(
array(
...
),
array(&$this, 'attachRegex'),
$sBody
)
);
}
return self::successful(
parent::get($params, $filename, $skip_head)
);
}
With this modification class should work with both old and new (git) version of Mail_Mime pear module.
Comment | File | Size | Author |
---|---|---|---|
#5 | mailmime-htmlbody.2525864.5.patch | 891 bytes | salvis |
Comments
Comment #1
spuki CreditAttribution: spuki commentedComment #2
spuki CreditAttribution: spuki commentedComment #3
spuki CreditAttribution: spuki commentedComment #4
spuki CreditAttribution: spuki commentedComment #5
salvisThank you for tracking this down and posting your patch, spuki!
The breakage was introduced in this patch on GitHub two weeks ago.
You've introduced tabs which are not allowed by the https://www.drupal.org/coding-standards#indenting .
Also, changing the indent level of the regexes makes them appear changed when they aren't. I want to minimize changes and not break history unnecessarily. So here's my take of the patch.
(Please set Status to NR when you upload a patch so that the testbot can check it.)
I'm assuming you're installing Mail MIME right now — would you help me to update the installation instructions on the front page, please?
See #2526362: Update installation instructions on the front page.
Comment #6
salvisIs the patch in #5 working?
Comment #7
spuki CreditAttribution: spuki commentedYes, it's working. What shall I do?
Comment #8
salvisSet Status to RTBC. :-)
Comment #9
spuki CreditAttribution: spuki commentedComment #11
salvisThanks!