"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/PHPMailer.php" between
PHPMailer-6.4.1.tar.gz and PHPMailer-6.5.0.tar.gz

About: PHPMailer is a PHP email transport class that features multiple file attachments, CCs, BCCs, REPLY-TOs, HTML messages, redundant SMTP servers, and word wrap, among others.

PHPMailer.php  (PHPMailer-6.4.1):PHPMailer.php  (PHPMailer-6.5.0)
skipping to change at line 431 skipping to change at line 431
* $mail->Debugoutput = new myPsr3Logger; * $mail->Debugoutput = new myPsr3Logger;
* ``` * ```
* *
* @see SMTP::$Debugoutput * @see SMTP::$Debugoutput
* *
* @var string|callable|\Psr\Log\LoggerInterface * @var string|callable|\Psr\Log\LoggerInterface
*/ */
public $Debugoutput = 'echo'; public $Debugoutput = 'echo';
/** /**
* Whether to keep SMTP connection open after each message. * Whether to keep the SMTP connection open after each message.
* If this is set to true then to close the connection * If this is set to true then the connection will remain open after a send,
* requires an explicit call to smtpClose(). * and closing the connection will require an explicit call to smtpClose().
* It's a good idea to use this if you are sending multiple messages as it r
educes overhead.
* See the mailing list example for how to use it.
* *
* @var bool * @var bool
*/ */
public $SMTPKeepAlive = false; public $SMTPKeepAlive = false;
/** /**
* Whether to split multiple to addresses into multiple messages * Whether to split multiple to addresses into multiple messages
* or send them all in one message. * or send them all in one message.
* Only supported in `mail` and `sendmail` transports, not in SMTP. * Only supported in `mail` and `sendmail` transports, not in SMTP.
* *
skipping to change at line 751 skipping to change at line 753
* *
* @var string * @var string
*/ */
protected $uniqueid = ''; protected $uniqueid = '';
/** /**
* The PHPMailer Version number. * The PHPMailer Version number.
* *
* @var string * @var string
*/ */
const VERSION = '6.4.1'; const VERSION = '6.5.0';
/** /**
* Error severity: message only, continue processing. * Error severity: message only, continue processing.
* *
* @var int * @var int
*/ */
const STOP_MESSAGE = 0; const STOP_MESSAGE = 0;
/** /**
* Error severity: message, likely ok to continue processing. * Error severity: message, likely ok to continue processing.
skipping to change at line 1338 skipping to change at line 1340
* @param string $address The email address to check * @param string $address The email address to check
* @param string|callable $patternselect Which pattern to use * @param string|callable $patternselect Which pattern to use
* *
* @return bool * @return bool
*/ */
public static function validateAddress($address, $patternselect = null) public static function validateAddress($address, $patternselect = null)
{ {
if (null === $patternselect) { if (null === $patternselect) {
$patternselect = static::$validator; $patternselect = static::$validator;
} }
if (is_callable($patternselect)) { //Don't allow strings as callables, see SECURITY.md and CVE-2021-3603
if (is_callable($patternselect) && !is_string($patternselect)) {
return call_user_func($patternselect, $address); return call_user_func($patternselect, $address);
} }
//Reject line breaks in addresses; it's valid RFC5322, but not RFC5321 //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321
if (strpos($address, "\n") !== false || strpos($address, "\r") !== false ) { if (strpos($address, "\n") !== false || strpos($address, "\r") !== false ) {
return false; return false;
} }
switch ($patternselect) { switch ($patternselect) {
case 'pcre': //Kept for BC case 'pcre': //Kept for BC
case 'pcre8': case 'pcre8':
/* /*
skipping to change at line 2185 skipping to change at line 2188
$this->smtp->close(); $this->smtp->close();
} }
} }
/** /**
* Set the language for error messages. * Set the language for error messages.
* Returns false if it cannot load the language file. * Returns false if it cannot load the language file.
* The default language is English. * The default language is English.
* *
* @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
* @param string $lang_path Path to the language file directory, with traili * @param string $lang_path Path to the language file directory, with traili
ng separator (slash) ng separator (slash).D
* Do not set this from user input!
* *
* @return bool * @return bool
*/ */
public function setLanguage($langcode = 'en', $lang_path = '') public function setLanguage($langcode = 'en', $lang_path = '')
{ {
//Backwards compatibility for renamed language codes //Backwards compatibility for renamed language codes
$renamed_langcodes = [ $renamed_langcodes = [
'br' => 'pt_br', 'br' => 'pt_br',
'cz' => 'cs', 'cz' => 'cs',
'dk' => 'da', 'dk' => 'da',
skipping to change at line 2247 skipping to change at line 2251
$langcode = 'en'; $langcode = 'en';
} }
$foundlang = true; $foundlang = true;
$lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php'; $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
//There is no English translation file //There is no English translation file
if ('en' !== $langcode) { if ('en' !== $langcode) {
//Make sure language file path is readable //Make sure language file path is readable
if (!static::fileIsAccessible($lang_file)) { if (!static::fileIsAccessible($lang_file)) {
$foundlang = false; $foundlang = false;
} else { } else {
//Overwrite language-specific strings. //$foundlang = include $lang_file;
//This way we'll never have missing translation keys. $lines = file($lang_file);
$foundlang = include $lang_file; foreach ($lines as $line) {
//Translation file lines look like this:
//$PHPMAILER_LANG['authenticate'] = 'SMTP-Fehler: Authentifi
zierung fehlgeschlagen.';
//These files are parsed as text and not PHP so as to avoid
the possibility of code injection
//See https://blog.stevenlevithan.com/archives/match-quoted-
string
$matches = [];
if (
preg_match(
'/^\$PHPMAILER_LANG\[\'([a-z\d_]+)\'\]\s*=\s*(["\'])
(.+)*?\2;/',
$line,
$matches
) &&
//Ignore unknown translation keys
array_key_exists($matches[1], $PHPMAILER_LANG)
) {
//Overwrite language-specific strings so we'll never hav
e missing translation keys.
$PHPMAILER_LANG[$matches[1]] = (string)$matches[3];
}
}
} }
} }
$this->language = $PHPMAILER_LANG; $this->language = $PHPMAILER_LANG;
return (bool) $foundlang; //Returns false if language not found return $foundlang; //Returns false if language not found
} }
/** /**
* Get the array of strings for the current language. * Get the array of strings for the current language.
* *
* @return array * @return array
*/ */
public function getTranslations() public function getTranslations()
{ {
return $this->language; return $this->language;
 End of changes. 6 change blocks. 
11 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)