From f55b2d0e57995fca5000790e18963ad0f3ef8830 Mon Sep 17 00:00:00 2001 From: Franck Villaume Date: Sat, 20 Nov 2021 17:03:43 +0100 Subject: [PATCH] do not shadow field --- src/common/frs/FRSRelease.class.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/common/frs/FRSRelease.class.php b/src/common/frs/FRSRelease.class.php index 0109bd1baf..278fb27014 100644 --- a/src/common/frs/FRSRelease.class.php +++ b/src/common/frs/FRSRelease.class.php @@ -92,13 +92,13 @@ class FRSRelease extends FFObject { /** * cached return value of getVotes - * @var int|bool $votes + * @var bool|array $votes */ var $votes = false; /** * cached return value of getVoters - * @var int|bool $voters + * @var bool|array $voters */ var $voters = false; @@ -677,16 +677,16 @@ class FRSRelease extends FFObject { return $this->votes; } - $voters = $this->getVoters(); - unset($voters[0]); /* just in case */ - unset($voters[100]); /* need users */ - if (($numvoters = count($voters)) < 1) { + $lvoters = $this->getVoters(); + unset($lvoters[0]); /* just in case */ + unset($lvoters[100]); /* need users */ + if (($numvoters = count($lvoters)) < 1) { $this->votes = array(0, 0, 0); return $this->votes; } $res = db_query_params('SELECT COUNT(*) AS count FROM frs_release_votes WHERE release_id = $1 AND user_id = ANY($2)', - array($this->getID(), db_int_array_to_any_clause($voters))); + array($this->getID(), db_int_array_to_any_clause($lvoters))); $db_count = db_fetch_array($res); $numvotes = $db_count['count']; @@ -694,8 +694,7 @@ class FRSRelease extends FFObject { if ($numvotes < 0 || $numvoters < $numvotes) { $this->votes = array(-1, -1, 0); } else { - $this->votes = array($numvotes, $numvoters, - (int)($numvotes * 100 / $numvoters + 0.5)); + $this->votes = array($numvotes, $numvoters, (int)($numvotes * 100 / $numvoters + 0.5)); } return $this->votes; } @@ -725,9 +724,9 @@ class FRSRelease extends FFObject { $this->voters = array(); if (($engine = RBACEngine::getInstance()) - && ($voters = $engine->getUsersByAllowedAction('frs', $this->getID(), 'read')) - && (count($voters) > 0)) { - foreach ($voters as $voter) { + && ($lvoters = $engine->getUsersByAllowedAction('frs', $this->getID(), 'read')) + && (count($lvoters) > 0)) { + foreach ($lvoters as $voter) { $voter_id = $voter->getID(); $this->voters[$voter_id] = $voter_id; } -- 2.30.2