summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-02-16 04:34:47 -0500
committerAleksander Machniak <alec@alec.pl>2015-02-16 04:34:47 -0500
commite25b0d7781edf02f15401078430c8d40f5c9e544 (patch)
tree6caa0b4dd4786c1f398408bdb7e3f6a8c06bf722
parent9ed6d46df7c2a555feeb3444c6acb0e5eaf452e9 (diff)
Fix a regression where some contact data was missing in export and PHP warnings were logged (Kolab #4522)
-rw-r--r--program/steps/addressbook/export.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index d2507c13c..c2f22cbe2 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -133,12 +133,13 @@ function prepare_for_export(&$record, $source = null)
foreach ($record as $key => $values) {
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())
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)) {
$vcard->set($field, $value, strtoupper($section));
}