Check for mbstring before trying to use it in parseAddresses

This commit is contained in:
Marcus Bointon 2021-02-23 08:59:11 +01:00
parent c626b9e165
commit 6b6badad3f
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
3 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,8 @@
# PHPMailer Change Log
## WIP
* Check for mbstring extension before decoding addresss in `parseAddress`
## Version 6.3.0 (February 19th, 2021)
* Handle early connection errors such as 421 during connection and EHLO states
* Switch to Github Actions for CI

View File

@ -40,7 +40,7 @@
"yoast/phpunit-polyfills": "^0.2.0"
},
"suggest": {
"ext-mbstring": "Needed to send email in multibyte encoding charset",
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
"psr/log": "For optional PSR-3 debug logging",

View File

@ -1199,7 +1199,7 @@ class PHPMailer
)
) {
//Decode the name part if it's present and encoded
if (property_exists($address, 'personal') && preg_match('/^=\?.*\?=$/', $address->personal)) {
if (extension_loaded('mbstring') && property_exists($address, 'personal') && preg_match('/^=\?.*\?=$/', $address->personal)) {
$address->personal = mb_decode_mimeheader($address->personal);
}