summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-01-07 17:04:21 +0100
committerThomas Bruederli <bruederli@kolabsys.com>2015-01-07 17:05:29 +0100
commit37757464fd4d603b7f8cd3038d5c85a2f92de855 (patch)
treef4aec07e705c132fa532ac3dfe13362349e8ee98 /program
parented32835aba6acd8445dd067c3ed8c96cb1092d25 (diff)
Correctly handle DateTime values in Vcard export
Diffstat (limited to 'program')
-rw-r--r--program/steps/addressbook/export.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index 2b45e5cd1..11e8f2aa8 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -131,8 +131,13 @@ function prepare_for_export(&$record, $source = null)
foreach ($record as $key => $values) {
list($field, $section) = explode(':', $key);
- foreach ((array)$values as $value) {
- if (is_array($value) || @strlen($value)) {
+ // avoid casting DateTime objects to array
+ // (same as in rcube_contacts::convert_save_data())
+ if (is_object($values) && is_a($values, 'DateTime')) {
+ $values = array(0 => $values);
+ }
+ foreach ($values as $value) {
+ if (is_array($value) || is_a($value, 'DateTime') || @strlen($value)) {
$vcard->set($field, $value, strtoupper($section));
}
}