Skip to content

Commit

Permalink
Fix PHP 8.0 Error: Argument #1 ($value) must be of type Countable|arr…
Browse files Browse the repository at this point in the history
…ay, null given
  • Loading branch information
ralfbecker committed Mar 28, 2022
1 parent 6390bb1 commit 85884c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions inc/class.projectmanager_pricelist_bo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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)
Expand All @@ -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;
}

Expand Down

0 comments on commit 85884c1

Please sign in to comment.