Changeset 49713
- Timestamp:
- 11/30/2020 05:08:24 PM (4 years ago)
- Location:
- trunk/src/wp-includes/PHPMailer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/PHPMailer/Exception.php
r49136 r49713 1 1 <?php 2 2 3 /** 3 4 * PHPMailer Exception class. -
trunk/src/wp-includes/PHPMailer/PHPMailer.php
r49136 r49713 1 1 <?php 2 2 3 /** 3 4 * PHPMailer - PHP email creation and transport class. … … 389 390 * Debug output level. 390 391 * Options: 391 * *SMTP::DEBUG_OFF: No output392 * *SMTP::DEBUG_CLIENT: Client messages393 * *SMTP::DEBUG_SERVER: Client and server messages394 * *SMTP::DEBUG_CONNECTION: As SERVER plus connection status395 * *SMTP::DEBUG_LOWLEVEL: Noisy, low-level data output, rarely needed392 * @see SMTP::DEBUG_OFF: No output 393 * @see SMTP::DEBUG_CLIENT: Client messages 394 * @see SMTP::DEBUG_SERVER: Client and server messages 395 * @see SMTP::DEBUG_CONNECTION: As SERVER plus connection status 396 * @see SMTP::DEBUG_LOWLEVEL: Noisy, low-level data output, rarely needed 396 397 * 397 398 * @see SMTP::$do_debug … … 748 749 * @var string 749 750 */ 750 const VERSION = '6. 1.8';751 const VERSION = '6.2.0'; 751 752 752 753 /** … … 1186 1187 $list = imap_rfc822_parse_adrlist($addrstr, ''); 1187 1188 foreach ($list as $address) { 1188 if (('.SYNTAX-ERROR.' !== $address->host) && static::validateAddress( 1189 $address->mailbox . '@' . $address->host 1190 )) { 1189 if ( 1190 ('.SYNTAX-ERROR.' !== $address->host) && static::validateAddress( 1191 $address->mailbox . '@' . $address->host 1192 ) 1193 ) { 1191 1194 $addresses[] = [ 1192 1195 'name' => (property_exists($address, 'personal') ? $address->personal : ''), … … 1242 1245 // Don't validate now addresses with IDN. Will be done in send(). 1243 1246 $pos = strrpos($address, '@'); 1244 if ((false === $pos) 1247 if ( 1248 (false === $pos) 1245 1249 || ((!$this->has8bitChars(substr($address, ++$pos)) || !static::idnSupported()) 1246 1250 && !static::validateAddress($address)) … … 1394 1398 // Verify we have required functions, CharSet, and at-sign. 1395 1399 $pos = strrpos($address, '@'); 1396 if (!empty($this->CharSet) && 1400 if ( 1401 !empty($this->CharSet) && 1397 1402 false !== $pos && 1398 1403 static::idnSupported() … … 1458 1463 public function preSend() 1459 1464 { 1460 if ('smtp' === $this->Mailer 1461 || ('mail' === $this->Mailer && stripos(PHP_OS, 'WIN') === 0) 1465 if ( 1466 'smtp' === $this->Mailer 1467 || ('mail' === $this->Mailer && (PHP_VERSION_ID >= 80000 || stripos(PHP_OS, 'WIN') === 0)) 1462 1468 ) { 1463 1469 //SMTP mandates RFC-compliant line endings … … 1469 1475 } 1470 1476 //Check for buggy PHP versions that add a header with an incorrect line break 1471 if ('mail' === $this->Mailer 1477 if ( 1478 'mail' === $this->Mailer 1472 1479 && ((PHP_VERSION_ID >= 70000 && PHP_VERSION_ID < 70017) 1473 1480 || (PHP_VERSION_ID >= 70100 && PHP_VERSION_ID < 70103)) … … 1556 1563 1557 1564 // Sign with DKIM if enabled 1558 if (!empty($this->DKIM_domain) 1565 if ( 1566 !empty($this->DKIM_domain) 1559 1567 && !empty($this->DKIM_selector) 1560 1568 && (!empty($this->DKIM_private_string) … … 1614 1622 } catch (Exception $exc) { 1615 1623 if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true) { 1616 $this->smtp->reset();1624 $this->smtp->reset(); 1617 1625 } 1618 1626 $this->setError($exc->getMessage()); … … 1720 1728 { 1721 1729 // Future-proof 1722 if (escapeshellcmd($string) !== $string 1730 if ( 1731 escapeshellcmd($string) !== $string 1723 1732 || !in_array(escapeshellarg($string), ["'$string'", "\"$string\""]) 1724 1733 ) { … … 1904 1913 } 1905 1914 1906 $callbacks[] = ['issent' =>$isSent, 'to'=>$to[0]];1915 $callbacks[] = ['issent' => $isSent, 'to' => $to[0]]; 1907 1916 } 1908 1917 } … … 1984 1993 foreach ($hosts as $hostentry) { 1985 1994 $hostinfo = []; 1986 if (!preg_match( 1987 '/^(?:(ssl|tls):\/\/)?(.+?)(?::(\d+))?$/', 1988 trim($hostentry), 1989 $hostinfo 1990 )) { 1995 if ( 1996 !preg_match( 1997 '/^(?:(ssl|tls):\/\/)?(.+?)(?::(\d+))?$/', 1998 trim($hostentry), 1999 $hostinfo 2000 ) 2001 ) { 1991 2002 $this->edebug($this->lang('invalid_hostentry') . ' ' . trim($hostentry)); 1992 2003 // Not a valid host entry … … 2057 2068 $this->smtp->hello($hello); 2058 2069 } 2059 if ($this->SMTPAuth && !$this->smtp->authenticate( 2060 $this->Username, 2061 $this->Password, 2062 $this->AuthType, 2063 $this->oauth 2064 )) { 2070 if ( 2071 $this->SMTPAuth && !$this->smtp->authenticate( 2072 $this->Username, 2073 $this->Password, 2074 $this->AuthType, 2075 $this->oauth 2076 ) 2077 ) { 2065 2078 throw new Exception($this->lang('authenticate')); 2066 2079 } … … 2120 2133 ]; 2121 2134 2122 if ( isset($renamed_langcodes[$langcode])) {2135 if (array_key_exists($langcode, $renamed_langcodes)) { 2123 2136 $langcode = $renamed_langcodes[$langcode]; 2124 2137 } … … 2429 2442 2430 2443 // sendmail and mail() extract Bcc from the header before sending 2431 if (( 2444 if ( 2445 ( 2432 2446 'sendmail' === $this->Mailer || 'qmail' === $this->Mailer || 'mail' === $this->Mailer 2433 2447 ) … … 3899 3913 { 3900 3914 //Simple syntax limits 3901 if (empty($host) 3915 if ( 3916 empty($host) 3902 3917 || !is_string($host) 3903 3918 || strlen($host) > 256 … … 4065 4080 continue; 4066 4081 } 4067 if (// Only process relative URLs if a basedir is provided (i.e. no absolute local paths) 4082 if ( 4083 // Only process relative URLs if a basedir is provided (i.e. no absolute local paths) 4068 4084 !empty($basedir) 4069 4085 // Ignore URLs containing parent dir traversal (..) … … 4087 4103 $directory .= '/'; 4088 4104 } 4089 if ($this->addEmbeddedImage( 4090 $basedir . $directory . $filename, 4091 $cid, 4092 $filename, 4093 static::ENCODING_BASE64, 4094 static::_mime_types((string) static::mb_pathinfo($filename, PATHINFO_EXTENSION)) 4095 ) 4105 if ( 4106 $this->addEmbeddedImage( 4107 $basedir . $directory . $filename, 4108 $cid, 4109 $filename, 4110 static::ENCODING_BASE64, 4111 static::_mime_types((string) static::mb_pathinfo($filename, PATHINFO_EXTENSION)) 4112 ) 4096 4113 ) { 4097 4114 $message = preg_replace( … … 4512 4529 } 4513 4530 if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) { 4531 if (PHP_MAJOR_VERSION < 8) { 4532 openssl_pkey_free($privKey); 4533 } 4534 4535 return base64_encode($signature); 4536 } 4537 if (PHP_MAJOR_VERSION < 8) { 4514 4538 openssl_pkey_free($privKey); 4515 4516 return base64_encode($signature); 4517 } 4518 openssl_pkey_free($privKey); 4539 } 4519 4540 4520 4541 return ''; -
trunk/src/wp-includes/PHPMailer/SMTP.php
r49136 r49713 1 1 <?php 2 2 3 /** 3 4 * PHPMailer RFC821 SMTP email transport class. … … 35 36 * @var string 36 37 */ 37 const VERSION = '6. 1.8';38 const VERSION = '6.2.0'; 38 39 39 40 /** … … 540 541 } 541 542 // Send encoded username and password 542 if (!$this->sendCommand( 543 'User & Password', 544 base64_encode("\0" . $username . "\0" . $password), 545 235 546 ) 543 if ( 544 !$this->sendCommand( 545 'User & Password', 546 base64_encode("\0" . $username . "\0" . $password), 547 235 548 ) 547 549 ) { 548 550 return false; … … 1087 1089 //If SMTP transcripts are left enabled, or debug output is posted online 1088 1090 //it can leak credentials, so hide credentials in all but lowest level 1089 if (self::DEBUG_LOWLEVEL > $this->do_debug && 1090 in_array($command, ['User & Password', 'Username', 'Password'], true)) { 1091 if ( 1092 self::DEBUG_LOWLEVEL > $this->do_debug && 1093 in_array($command, ['User & Password', 'Username', 'Password'], true) 1094 ) { 1091 1095 $this->edebug('CLIENT -> SERVER: [credentials hidden]', self::DEBUG_CLIENT); 1092 1096 } else { … … 1208 1212 ); 1209 1213 1210 //stream_select returns false when the `select` system call is interrupted by an incoming signal, try the select again 1214 //stream_select returns false when the `select` system call is interrupted 1215 //by an incoming signal, try the select again 1211 1216 if (stripos($message, 'interrupted system call') !== false) { 1212 1217 $this->edebug(
Note: See TracChangeset
for help on using the changeset viewer.