From bc5a7db78237c4e9671fe0f9a5beb8e9e6f31a36 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 28 Mar 2022 17:13:32 +0300 Subject: [PATCH] Fix PHP 8.0 Error: Argument #1 ($value) must be of type Countable|array, null given --- inc/class.projectmanager_pricelist_bo.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/class.projectmanager_pricelist_bo.inc.php b/inc/class.projectmanager_pricelist_bo.inc.php index c2a2dff..31daca4 100644 --- a/inc/class.projectmanager_pricelist_bo.inc.php +++ b/inc/class.projectmanager_pricelist_bo.inc.php @@ -80,7 +80,7 @@ function save($keys=null,$extra_where=null) $this->data =& $backup; unset($backup); } - $need_general = count($old['prices']) > 0 || count($this->data['prices']) > 0; + $need_general = !empty($old['prices']) || !empty($this->data['prices']); if (!($pricelist_need_save = !$this->data['pl_id'])) { $this->data['cat_id'] = (int) $this->data['cat_id']; @@ -111,7 +111,7 @@ function save($keys=null,$extra_where=null) $price['pm_id'] = 0; $price['pl_billable'] = $this->data['gen_pl_billable'] === '' ? null : $this->data['gen_pl_billable']; $price['pl_customertitle'] = null; - if (count($this->data['prices']) == 1) $price['pl_validsince'] = 0; // no date for first price + if (count($this->data['prices'] ?? []) == 1) $price['pl_validsince'] = 0; // no date for first price $prices[] =& $price; } foreach($this->data['project_prices'] as &$price) @@ -120,7 +120,7 @@ function save($keys=null,$extra_where=null) { if (!isset($price[$key])) $price[$key] = $this->data[$key]; } - if (count($this->data['project_prices']) == 1) $price['pl_validsince'] = 0; // no date for first price + if (count($this->data['project_prices'] ?? []) == 1) $price['pl_validsince'] = 0; // no date for first price $prices[] =& $price; }