summaryrefslogtreecommitdiff
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:04:21 +0100
commit7d8592e64d4b17b42dbfd4be71182605d6bdcc1c (patch)
treec61180f9c012120bcfb0b6425128bf3ce9088cad
parent71bb89206306bb3cd842ab9acdbbd759ce9fa2cf (diff)
Correctly handle DateTime values in Vcard export
-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 a6d3af978..d2507c13c 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -133,8 +133,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));
}
}