Make WordPress Core


Ignore:
Timestamp:
12/24/2015 01:58:33 AM (9 years ago)
Author:
pento
Message:

Upgrade PHPMailer from 5.2.10 to 5.2.14.

The full list of changes is available here: https://github.com/PHPMailer/PHPMailer/compare/v5.2.10...v5.2.14

Fixes #35212 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-smtp.php

    r33124 r36083  
    2929    /**
    3030     * The PHPMailer SMTP version number.
    31      * @type string
    32      */
    33     const VERSION = '5.2.10';
     31     * @var string
     32     */
     33    const VERSION = '5.2.14';
    3434
    3535    /**
    3636     * SMTP line break constant.
    37      * @type string
     37     * @var string
    3838     */
    3939    const CRLF = "\r\n";
     
    4141    /**
    4242     * The SMTP port to use if one is not specified.
    43      * @type integer
     43     * @var integer
    4444     */
    4545    const DEFAULT_SMTP_PORT = 25;
     
    4747    /**
    4848     * The maximum line length allowed by RFC 2822 section 2.1.1
    49      * @type integer
     49     * @var integer
    5050     */
    5151    const MAX_LINE_LENGTH = 998;
     
    7878    /**
    7979     * The PHPMailer SMTP Version number.
    80      * @type string
     80     * @var string
    8181     * @deprecated Use the `VERSION` constant instead
    8282     * @see SMTP::VERSION
    8383     */
    84     public $Version = '5.2.10';
     84    public $Version = '5.2.14';
    8585
    8686    /**
    8787     * SMTP server port number.
    88      * @type integer
     88     * @var integer
    8989     * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
    9090     * @see SMTP::DEFAULT_SMTP_PORT
     
    9494    /**
    9595     * SMTP reply line ending.
    96      * @type string
     96     * @var string
    9797     * @deprecated Use the `CRLF` constant instead
    9898     * @see SMTP::CRLF
     
    108108     * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
    109109     * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
    110      * @type integer
     110     * @var integer
    111111     */
    112112    public $do_debug = self::DEBUG_OFF;
     
    123123     * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
    124124     * </code>
    125      * @type string|callable
     125     * @var string|callable
    126126     */
    127127    public $Debugoutput = 'echo';
     
    131131     * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
    132132     * @link http://www.postfix.org/VERP_README.html Info on VERP
    133      * @type boolean
     133     * @var boolean
    134134     */
    135135    public $do_verp = false;
     
    140140     * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
    141141     * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
    142      * @type integer
     142     * @var integer
    143143     */
    144144    public $Timeout = 300;
     
    147147     * How long to wait for commands to complete, in seconds.
    148148     * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
    149      * @type integer
     149     * @var integer
    150150     */
    151151    public $Timelimit = 300;
     
    153153    /**
    154154     * The socket for the server connection.
    155      * @type resource
     155     * @var resource
    156156     */
    157157    protected $smtp_conn;
     
    159159    /**
    160160     * Error information, if any, for the last SMTP command.
    161      * @type array
     161     * @var array
    162162     */
    163163    protected $error = array(
     
    171171     * The reply the server sent to us for HELO.
    172172     * If null, no HELO string has yet been received.
    173      * @type string|null
     173     * @var string|null
    174174     */
    175175    protected $helo_rply = null;
     
    182182     * Other values can be boolean TRUE or an array containing extension options.
    183183     * If null, no HELO/EHLO string has yet been received.
    184      * @type array|null
     184     * @var array|null
    185185     */
    186186    protected $server_caps = null;
     
    188188    /**
    189189     * The most recent reply received from the server.
    190      * @type string
     190     * @var string
    191191     */
    192192    protected $last_reply = '';
     
    352352     * Must be run after hello().
    353353     * @see hello()
    354      * @param string $username    The user name
    355      * @param string $password    The password
    356      * @param string $authtype    The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
    357      * @param string $realm       The auth realm for NTLM
     354     * @param string $username The user name
     355     * @param string $password The password
     356     * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2)
     357     * @param string $realm The auth realm for NTLM
    358358     * @param string $workstation The auth workstation for NTLM
    359      * @access public
    360      * @return boolean True if successfully authenticated.
     359     * @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
     360     * @return bool True if successfully authenticated.* @access public
    361361     */
    362362    public function authenticate(
     
    365365        $authtype = null,
    366366        $realm = '',
    367         $workstation = ''
     367        $workstation = '',
     368        $OAuth = null
    368369    ) {
    369370        if (!$this->server_caps) {
     
    674675        $this->server_caps = array();
    675676        $lines = explode("\n", $this->last_reply);
     677
    676678        foreach ($lines as $n => $s) {
     679            //First 4 chars contain response code followed by - or space
    677680            $s = trim(substr($s, 4));
    678             if (!$s) {
     681            if (empty($s)) {
    679682                continue;
    680683            }
     
    686689                } else {
    687690                    $name = array_shift($fields);
    688                     if ($name == 'SIZE') {
    689                         $fields = ($fields) ? $fields[0] : 0;
     691                    switch ($name) {
     692                        case 'SIZE':
     693                            $fields = ($fields ? $fields[0] : 0);
     694                            break;
     695                        case 'AUTH':
     696                            if (!is_array($fields)) {
     697                                $fields = array();
     698                            }
     699                            break;
     700                        default:
     701                            $fields = true;
    690702                    }
    691703                }
    692                 $this->server_caps[$name] = ($fields ? $fields : true);
     704                $this->server_caps[$name] = $fields;
    693705            }
    694706        }
     
    740752     * Returns true if the recipient was accepted false if it was rejected.
    741753     * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
    742      * @param string $toaddr The address the message is being sent to
    743      * @access public
    744      * @return boolean
    745      */
    746     public function recipient($toaddr)
     754     * @param string $address The address the message is being sent to
     755     * @access public
     756     * @return boolean
     757     */
     758    public function recipient($address)
    747759    {
    748760        return $this->sendCommand(
    749761            'RCPT TO',
    750             'RCPT TO:<' . $toaddr . '>',
     762            'RCPT TO:<' . $address . '>',
    751763            array(250, 251)
    752764        );
     
    767779    /**
    768780     * Send a command to an SMTP server and check its return code.
    769      * @param string $command       The command name - not sent to the server
     781     * @param string $command The command name - not sent to the server
    770782     * @param string $commandstring The actual command to send
    771      * @param integer|array $expect     One or more expected integer success codes
     783     * @param integer|array $expect One or more expected integer success codes
    772784     * @access protected
    773785     * @return boolean True on success.
     
    777789        if (!$this->connected()) {
    778790            $this->setError("Called $command without being connected");
     791            return false;
     792        }
     793        //Reject line breaks in all commands
     794        if (strpos($commandstring, "\n") !== false or strpos($commandstring, "\r") !== false) {
     795            $this->setError("Command '$command' contained line breaks");
    779796            return false;
    780797        }
     
    982999        while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
    9831000            $str = @fgets($this->smtp_conn, 515);
    984             $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL);
    985             $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
     1001            $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
     1002            $this->edebug("SMTP -> get_lines(): \$str is  \"$str\"", self::DEBUG_LOWLEVEL);
    9861003            $data .= $str;
    987             $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
    9881004            // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
    9891005            if ((isset($str[3]) and $str[3] == ' ')) {
Note: See TracChangeset for help on using the changeset viewer.