Fix a regression where some contact data was missing in export and PHP warnings were logged (Kolab #4522)

pull/257/head
Aleksander Machniak 10 years ago
parent 9ed6d46df7
commit e25b0d7781

@ -133,12 +133,13 @@ function prepare_for_export(&$record, $source = null)
foreach ($record as $key => $values) { foreach ($record as $key => $values) {
list($field, $section) = explode(':', $key); list($field, $section) = explode(':', $key);
// avoid casting DateTime objects to array // avoid unwanted casting of DateTime objects to an array
// (same as in rcube_contacts::convert_save_data()) // (same as in rcube_contacts::convert_save_data())
if (is_object($values) && is_a($values, 'DateTime')) { if (is_object($values) && is_a($values, 'DateTime')) {
$values = array(0 => $values); $values = array($values);
} }
foreach ($values as $value) {
foreach ((array) $values as $value) {
if (is_array($value) || is_a($value, 'DateTime') || @strlen($value)) { if (is_array($value) || is_a($value, 'DateTime') || @strlen($value)) {
$vcard->set($field, $value, strtoupper($section)); $vcard->set($field, $value, strtoupper($section));
} }

Loading…
Cancel
Save