From fd53dfe82bd6716e0cbf9f84ae488748bcd2155f Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 27 Apr 2022 11:55:03 -0600 Subject: [PATCH] Fix PHP error if cf['type2'] is a single value, not array --- api/src/Storage/Customfields.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/api/src/Storage/Customfields.php b/api/src/Storage/Customfields.php index 49e32bb0b8..f79028d5f7 100644 --- a/api/src/Storage/Customfields.php +++ b/api/src/Storage/Customfields.php @@ -413,16 +413,16 @@ class Customfields implements \IteratorAggregate } self::$db->$op(self::TABLE, array( - 'cf_label' => $cf['label'], - 'cf_type' => $cf['type'], - 'cf_type2' => $cf['type2'] ? implode(',', $cf['type2']) : null, - 'cf_help' => $cf['help'], - 'cf_values' => $cf['values'] ? json_encode($cf['values']) : null, - 'cf_len' => (string)$cf['len'] !== '' ? $cf['len'] : null, - 'cf_rows' => (string)$cf['rows'] !== '' ? $cf['rows'] : null, - 'cf_order' => $cf['order'], - 'cf_needed' => $cf['needed'], - 'cf_private' => $cf['private'] ? implode(',', $cf['private']) : null, + 'cf_label' => $cf['label'], + 'cf_type' => $cf['type'], + 'cf_type2' => $cf['type2'] ? (is_array($cf['type2']) ? implode(',', $cf['type2']) : $cf['type2']) : null, + 'cf_help' => $cf['help'], + 'cf_values' => $cf['values'] ? json_encode($cf['values']) : null, + 'cf_len' => (string)$cf['len'] !== '' ? $cf['len'] : null, + 'cf_rows' => (string)$cf['rows'] !== '' ? $cf['rows'] : null, + 'cf_order' => $cf['order'], + 'cf_needed' => $cf['needed'], + 'cf_private' => $cf['private'] ? implode(',', $cf['private']) : null, 'cf_modifier' => $GLOBALS['egw_info']['user']['account_id'], 'cf_modified' => time(), ), array(