Fix bug where unicode contact names could have been broken/emptied or caused DB errors (#6299)

pull/6043/merge
Aleksander Machniak 7 years ago
parent 30ab2eec5f
commit 6691756ea1

@ -92,6 +92,7 @@ CHANGELOG Roundcube Webmail
- Fix bug where some escape sequences in html styles could bypass security checks - Fix bug where some escape sequences in html styles could bypass security checks
- Fix bug where some forbidden characters on Cyrus-IMAP were not prevented from use in folder names - Fix bug where some forbidden characters on Cyrus-IMAP were not prevented from use in folder names
- Fix bug where only attachments with the same name would be ignored on zip download (#6301) - Fix bug where only attachments with the same name would be ignored on zip download (#6301)
- Fix bug where unicode contact names could have been broken/emptied or caused DB errors (#6299)
RELEASE 1.3.6 RELEASE 1.3.6
------------- -------------

@ -509,7 +509,7 @@ abstract class rcube_addressbook
// default display name composition according to vcard standard // default display name composition according to vcard standard
if (!$fn) { if (!$fn) {
$fn = join(' ', array_filter(array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix']))); $fn = join(' ', array_filter(array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix'])));
$fn = trim(preg_replace('/\s+/', ' ', $fn)); $fn = trim(preg_replace('/\s+/u', ' ', $fn));
} }
// use email address part for name // use email address part for name
@ -560,7 +560,7 @@ abstract class rcube_addressbook
} }
$fn = trim($fn, ', '); $fn = trim($fn, ', ');
$fn = preg_replace('/\s+/', ' ', $fn); $fn = preg_replace('/\s+/u', ' ', $fn);
// fallbacks... // fallbacks...
if ($fn === '') { if ($fn === '') {
@ -637,8 +637,8 @@ abstract class rcube_addressbook
} }
} }
$result = preg_replace('/\s+/', ' ', $result); $result = preg_replace('/\s+/u', ' ', $result);
$result = preg_replace('/\s*(<>|\(\)|\[\])/', '', $result); $result = preg_replace('/\s*(<>|\(\)|\[\])/u', '', $result);
$result = trim($result, '/ '); $result = trim($result, '/ ');
return $result; return $result;

Loading…
Cancel
Save