summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-08-03 11:28:28 +0200
committerAleksander Machniak <alec@alec.pl>2012-08-03 11:30:10 +0200
commit6ec384479029dd15022e1ffde18bd4ceefc3bae3 (patch)
treed4492ee61b1dbb89de23249277014bfd95f051f0
parentc4841d73dbf8628533b26a4eeac2c32c8f473891 (diff)
Fix duplicated fields when object is converted into array
-rw-r--r--program/steps/addressbook/func.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index bd3819436..9ab02dc99 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -583,8 +583,13 @@ function rcmail_contact_form($form, $record, $attrib = null)
if (empty($values) && $colprop['visible'])
$values[] = '';
+ if (!is_array($values)) {
+ // $values can be an object, don't use (array)$values syntax
+ $values = !empty($values) ? array($values) : array();
+ }
+
$rows = '';
- foreach ((array)$values as $i => $val) {
+ foreach ($values as $i => $val) {
if ($subtypes[$i])
$subtype = $subtypes[$i];
@@ -641,7 +646,7 @@ function rcmail_contact_form($form, $record, $attrib = null)
$val = $colprop['options'][$val];
else
$val = Q($val);
-
+console($val);
// use subtype as label
if ($colprop['subtypes'])
$label = rcmail_get_type_label($subtype);