Ticket #40472: 40472.diff
File 40472.diff, 6.7 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-phpmailer.php
31 31 * The PHPMailer Version number. 32 32 * @var string 33 33 */ 34 public $Version = '5.2.2 2';34 public $Version = '5.2.23'; 35 35 36 36 /** 37 37 * Email priority. -
src/wp-includes/class-smtp.php
30 30 * The PHPMailer SMTP version number. 31 31 * @var string 32 32 */ 33 const VERSION = '5.2.2 2';33 const VERSION = '5.2.23'; 34 34 35 35 /** 36 36 * SMTP line break constant. … … 81 81 * @deprecated Use the `VERSION` constant instead 82 82 * @see SMTP::VERSION 83 83 */ 84 public $Version = '5.2.2 2';84 public $Version = '5.2.23'; 85 85 86 86 /** 87 87 * SMTP server port number. … … 231 231 preg_replace('/[\r\n]+/', '', $str), 232 232 ENT_QUOTES, 233 233 'UTF-8' 234 ) 235 . "<br>\n"; 234 ) . "<br>\n"; 236 235 break; 237 236 case 'echo': 238 237 default: … … 242 241 "\n", 243 242 "\n \t ", 244 243 trim($str) 245 ) ."\n";244 ) . "\n"; 246 245 } 247 246 } 248 247 … … 276 275 } 277 276 // Connect to the SMTP server 278 277 $this->edebug( 279 "Connection: opening to $host:$port, timeout=$timeout, options=".var_export($options, true), 278 "Connection: opening to $host:$port, timeout=$timeout, options=" . 279 var_export($options, true), 280 280 self::DEBUG_CONNECTION 281 281 ); 282 282 $errno = 0; … … 362 362 } 363 363 364 364 // Begin encrypted connection 365 if (!stream_socket_enable_crypto( 365 set_error_handler(array($this, 'errorHandler')); 366 $crypto_ok = stream_socket_enable_crypto( 366 367 $this->smtp_conn, 367 368 true, 368 369 $crypto_method 369 )) { 370 return false; 371 } 372 return true; 370 ); 371 restore_error_handler(); 372 return $crypto_ok; 373 373 } 374 374 375 375 /** … … 398 398 } 399 399 400 400 if (array_key_exists('EHLO', $this->server_caps)) { 401 // SMTP extensions are available. Let's try to find a proper authentication method 402 401 // SMTP extensions are available; try to find a proper authentication method 403 402 if (!array_key_exists('AUTH', $this->server_caps)) { 404 403 $this->setError('Authentication is not allowed at this stage'); 405 404 // 'at this stage' means that auth may be allowed after the stage changes … … 424 423 $this->setError('No supported authentication methods found'); 425 424 return false; 426 425 } 427 self::edebug('Auth method selected: ' .$authtype, self::DEBUG_LOWLEVEL);426 self::edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL); 428 427 } 429 428 430 429 if (!in_array($authtype, $this->server_caps['AUTH'])) { … … 487 486 * Works like hash_hmac('md5', $data, $key) 488 487 * in case that function is not available 489 488 * @param string $data The data to hash 490 * @param string $key 489 * @param string $key The key to hash with 491 490 * @access protected 492 491 * @return string 493 492 */ … … 830 829 $code_ex = (count($matches) > 2 ? $matches[2] : null); 831 830 // Cut off error code from each response line 832 831 $detail = preg_replace( 833 "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m", 832 "/{$code}[ -]" . 833 ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . "/m", 834 834 '', 835 835 $this->last_reply 836 836 ); … … 1042 1042 // Now check if reads took too long 1043 1043 if ($endtime and time() > $endtime) { 1044 1044 $this->edebug( 1045 'SMTP -> get_lines(): timelimit reached (' .1045 'SMTP -> get_lines(): timelimit reached (' . 1046 1046 $this->Timelimit . ' sec)', 1047 1047 self::DEBUG_LOWLEVEL 1048 1048 ); … … 1145 1145 * Reports an error number and string. 1146 1146 * @param integer $errno The error number returned by PHP. 1147 1147 * @param string $errmsg The error message returned by PHP. 1148 * @param string $errfile The file the error occurred in 1149 * @param integer $errline The line number the error occurred on 1148 1150 */ 1149 protected function errorHandler($errno, $errmsg )1151 protected function errorHandler($errno, $errmsg, $errfile = '', $errline = 0) 1150 1152 { 1151 $notice = 'Connection : Failed to connect to server.';1153 $notice = 'Connection failed.'; 1152 1154 $this->setError( 1153 1155 $notice, 1154 1156 $errno, … … 1155 1157 $errmsg 1156 1158 ); 1157 1159 $this->edebug( 1158 $notice . ' Error number ' . $errno . '. "Error notice: ' . $errmsg,1160 $notice . ' Error #' . $errno . ': ' . $errmsg . " [$errfile line $errline]", 1159 1161 self::DEBUG_CONNECTION 1160 1162 ); 1161 1163 } 1162 1164 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1165 /** 1166 * Will return the ID of the last smtp transaction based on a list of patterns provided 1167 * in SMTP::$smtp_transaction_id_patterns. 1168 * If no reply has been received yet, it will return null. 1169 * If no pattern has been matched, it will return false. 1170 * @return bool|null|string 1171 */ 1172 public function getLastTransactionID() 1173 { 1174 $reply = $this->getLastReply(); 1173 1175 1174 1175 1176 1176 if (empty($reply)) { 1177 return null; 1178 } 1177 1179 1178 foreach($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {1179 if(preg_match($smtp_transaction_id_pattern, $reply, $matches)) {1180 1181 1182 1180 foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) { 1181 if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) { 1182 return $matches[1]; 1183 } 1184 } 1183 1185 1184 1186 return false; 1185 1187 } 1186 1188 }