Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#9697 closed enhancement (fixed)

Update PHP mailer to latest version [ 2.0.4 ]

Reported by: simek's profile Simek Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7.1
Component: Mail Keywords: needs-patch dev-feedback
Focuses: Cc:

Description

Update PHP mailer to lates version - 2.0.4. Until WordPress supports PHP4 we can't upgrade this script to true latest version but it isn't very important component which make a pressuer to drop out PHP4 support.

Changelog since actual version in WordPres:

Version 2.0.4 (April 02 2009)
* fixed == in class.smtp.php
- NOTE: this is it folks, our last PHPMailer to support PHP4

Version 2.0.3 (November 08 2008)
* fixed line 1041 in class.smtp.php (endless loop from missing = sign)
* fixed duplicate images in email body
* removed English language from language files and made it a default within
  class.phpmailer.php - if no language is found, it will default to use
  the english language translation
* corrected $basedir to $directory
* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user
  if default is not acceptable
* removed trim() from return results in EncodeQP
* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg);
* We have removed the /phpdoc from the downloads. All documentation is now on
  the http://phpmailer.codeworxtech.com website.

Attachments (4)

9697.patch (14.9 KB) - added by hakre 15 years ago.
Update to Phpmailer 2.0.4 (from 2.0.2)
9697.2.patch (14.6 KB) - added by hakre 15 years ago.
missing delimiter added for pcre pattern
9697.3.patch (14.6 KB) - added by hakre 15 years ago.
Updated patch: removal of pcre /e modifiers.
9697.4.patch (14.6 KB) - added by hakre 15 years ago.
Callbacks as static function calls.

Download all attachments as: .zip

Change History (33)

@hakre
15 years ago

Update to Phpmailer 2.0.4 (from 2.0.2)

#2 @hakre
15 years ago

  • Keywords has-patch 2nd-opinion added; needs-patch removed

#3 @hakre
15 years ago

#8800 is not related to phpmailer.

#4 @Denis-de-Bernardy
15 years ago

  • Keywords dev-feedback added; 2nd-opinion removed

+1

#5 @Denis-de-Bernardy
15 years ago

we might as well upgrade this to the latest (and last, until we switch to php5).

and possibly patch it a little, too. namely on the html_entity_decode() call, to add a charset if needed (with an @, to avoid the pesky php4 issues with utf-8).

#6 follow-up: @hakre
15 years ago

I patched this one according to the changes in the old one but not one areay. I will take a look into it again after your comment.

Further I was now able to test the patch by sending out registration emails. Looks good to me so far:

Return-Path: <artnorm@googlemail.com>
Received: from xxx.gmail.com (xxxxxxxxx)
        by mx.google.com with ESMTPS id j9sm10880067mue.51.2009.05.02.07.04.56
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 02 May 2009 07:04:56 -0700 (PDT)
To: xxxxxx@gmail.com
Subject: [wordpress-trunk] Your username and password
Date: Sat, 2 May 2009 16:05:35 +0200
Return-Path: wordpress@192.168.2.106
From: WordPress <xxxxxxxxxx@xxxxxxxxx>
Message-ID: <8d3aa4a41692c5d4f0e98eb3fa4b1add@192.168.2.106>
X-Priority: 3
X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.4]
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="UTF-8"

Username: xxxxx
Password: xxxxxxxxxx
http://192.168.2.106/wordpress-trunk/wp-login.php

This is the latest phpmailer version for php 4 as far as I'm concerned.

#7 in reply to: ↑ 6 @Denis-de-Bernardy
15 years ago

Replying to hakre:

This is the latest phpmailer version for php 4 as far as I'm concerned.

Yeah. It's documented as dead branch material, too. So better than (with the latest fixes) than our current one.

#8 @hakre
15 years ago

Here is something I can not confirm that the change has been made correct. Change from:
{{{ /* There should not be any EOL in the string */

$encoded = preg_replace("/[\r\n]/", , $str);}}}

To:
{{{ /* There should not be any EOL in the string */
$encoded = preg_replace("[\r\n]", , $str);}}}
The later one will only remove the strings "\r\n" and not any combination of "\r" and "\n". The code is related to quoted printable ( function EncodeQ() ). I'm not well with quoted printable and do not understand fully the term EOL here.

But what I can say is, that it is not explicitly named in the changelog and therefore I assume that this might be an accident. Another Sign of that being an accident is the case, that it is not a valid pcre pattern. the starting and ending delimiter have been left out. as far as i know this is not possible.

I will try to pose the question with the phpmailer project. Until that I suggested to patch this place it.

@hakre
15 years ago

missing delimiter added for pcre pattern

#9 follow-up: @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch added; has-patch dev-feedback removed

I'm pretty sure that EncodeQ_callback et all were added by WP to avoid using the /e suffix in regex, due to some hosts failing because of safe_mode or some stuff like that.

#10 in reply to: ↑ 9 @hakre
15 years ago

Replying to Denis-de-Bernardy:

I'm pretty sure that EncodeQ_callback et all were added by WP to avoid using the /e suffix in regex, due to some hosts failing because of safe_mode or some stuff like that.

thanks for poiting to it, completely right. i updated the patch to remove the /e switches.

additionally there seems to be a Bug in the current version. preg_replace_callback() needs a valid callback as second parameter. the provided value is not a valid callback value (tested with php 5). this bug has been removed in the updated patch as well.

@hakre
15 years ago

Updated patch: removal of pcre /e modifiers.

#11 @Denis-de-Bernardy
15 years ago

very correct. opening a separate ticket to highlight it.

#12 @Denis-de-Bernardy
15 years ago

  • Keywords has-patch added; needs-patch removed

patch I added to #9722 uses a static call for the callback, to make things less memory hungry in php4.

@hakre
15 years ago

Callbacks as static function calls.

#13 @hakre
15 years ago

Updated to static function callbacks. Suggested by Denis-de-Bernardy:, See #9722


Denis, I am not shure that this is less memory hungry since the instance of $this already is there. Please teach me :D

#14 @Denis-de-Bernardy
15 years ago

in php4, array($this, "foo") generates a clone, as opposed to array(&$this, "foo")

#15 @hakre
15 years ago

if not: in an object method, $this is always a reference to the caller object.

#16 @ryan
15 years ago

(In [11195]) Fix callbacks. Props Denis-de-Bernardy. fixes #9722 see #9697

#19 @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 2.8 to Future Release

patch is b0rke + the comment on #7474 needs to be looked into

#20 @hakre
15 years ago

Denis, I do not get what you mean. What do you think what should be done?

#21 @Denis-de-Bernardy
15 years ago

  • Keywords dev-feedback added

http://core.trac.wordpress.org/ticket/7474#comment:7 suggests there were a few security-related commits on the existing file.

http://core.trac.wordpress.org/log/trunk/wp-includes/class-smtp.php does seem to reveal anything, though.

#22 @hakre
15 years ago

I read 7474#comment:7 in that way, that it is talking about the security realted commits within the phpmailer project. I read your words that you interprete them as changes in WordPress codebase. So in my eyes good to go.

#23 @Denis-de-Bernardy
15 years ago

I sent a quick note in wordpress-dev

#24 @hakre
15 years ago

  • Summary changed from Update PHP mailer to lates version [ 2.0.4 ] to Update PHP mailer to latest version [ 2.0.4 ]

i still have no access there. problems getting registered.

#25 @Denis-de-Bernardy
15 years ago

oh, I was meaning the IRC channel: wordpress-dev on freenode.net

#26 @ryan
15 years ago

[5682], [10459], and [11195] are our local mods. All seem to be intact. One hunk of 9697.4 fails, but that looks like a collision that [11195] that should be fine.

#28 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

#29 @Denis-de-Bernardy
15 years ago

  • Milestone changed from Future Release to 2.8
Note: See TracTickets for help on using tickets.