From 52830ea6056dc85d8ffcb0cfb7ead7d70624e109 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Tue, 10 Sep 2013 17:37:10 -0400
Subject: [PATCH] Improve handling of date strings and DateTime values in contacts

---
 program/lib/Roundcube/rcube_contacts.php |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php
index 3919cdc..6d01368 100644
--- a/program/lib/Roundcube/rcube_contacts.php
+++ b/program/lib/Roundcube/rcube_contacts.php
@@ -718,6 +718,10 @@
         foreach ($save_data as $key => $values) {
             list($field, $section) = explode(':', $key);
             $fulltext = in_array($field, $this->fulltext_cols);
+            // avoid casting DateTime objects to array
+            if (is_object($values) && is_a($values, 'DateTime')) {
+                $values = array(0 => $values);
+            }
             foreach ((array)$values as $value) {
                 if (isset($value))
                     $vcard->set($field, $value, $section);

--
Gitblit v1.9.1