From 5466f71dd6d38bfecea6d11172d9b0d67a7e5083 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 23 Feb 2016 02:31:14 -0500
Subject: [PATCH] Fix a regression where some contact data was missing in export and PHP warnings were logged (Kolab #4522)

---
 program/steps/addressbook/export.inc |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index c83f7b3..5270d15 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -128,12 +128,13 @@
 
         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));
                 }

--
Gitblit v1.9.1