Skip to content

Commit bc5a7db

Browse files
committed
Fix PHP 8.0 Error: Argument #1 ($value) must be of type Countable|array, null given
1 parent 732d93c commit bc5a7db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

inc/class.projectmanager_pricelist_bo.inc.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function save($keys=null,$extra_where=null)
8080
$this->data =& $backup;
8181
unset($backup);
8282
}
83-
$need_general = count($old['prices']) > 0 || count($this->data['prices']) > 0;
83+
$need_general = !empty($old['prices']) || !empty($this->data['prices']);
8484
if (!($pricelist_need_save = !$this->data['pl_id']))
8585
{
8686
$this->data['cat_id'] = (int) $this->data['cat_id'];
@@ -111,7 +111,7 @@ function save($keys=null,$extra_where=null)
111111
$price['pm_id'] = 0;
112112
$price['pl_billable'] = $this->data['gen_pl_billable'] === '' ? null : $this->data['gen_pl_billable'];
113113
$price['pl_customertitle'] = null;
114-
if (count($this->data['prices']) == 1) $price['pl_validsince'] = 0; // no date for first price
114+
if (count($this->data['prices'] ?? []) == 1) $price['pl_validsince'] = 0; // no date for first price
115115
$prices[] =& $price;
116116
}
117117
foreach($this->data['project_prices'] as &$price)
@@ -120,7 +120,7 @@ function save($keys=null,$extra_where=null)
120120
{
121121
if (!isset($price[$key])) $price[$key] = $this->data[$key];
122122
}
123-
if (count($this->data['project_prices']) == 1) $price['pl_validsince'] = 0; // no date for first price
123+
if (count($this->data['project_prices'] ?? []) == 1) $price['pl_validsince'] = 0; // no date for first price
124124
$prices[] =& $price;
125125
}
126126

0 commit comments

Comments
 (0)