Skip to content

Commit

Permalink
Prevent E_WARNING for non-countable type
Browse files Browse the repository at this point in the history
ABF::__isListed returns a boolean value, which is not countable. Attempting to count non-countable types will emit an E_WARNING since PHP 7.2; see: http://php.net/manual/de/migration72.incompatible.php
  • Loading branch information
michael-e committed Jan 10, 2021
1 parent 5fe2ed9 commit c2721d0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/class.ABF.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,11 @@ private function __registerToList($tbl, $source, $ip='')
{
$ip = $this->getIP($ip);
$source = MySQL::cleanValue($source);
$results = $this->__isListed($tbl, $ip);
$isGray = $tbl == $this->TBL_ABF_GL;
$ret = false;

// do not re-register existing entries
if ($results != null && count($results) > 0) {
if ($this->__isListed($tbl, $ip)) {
if ($isGray) {
$ret = $this->incrementGrayList($ip);
}
Expand Down

0 comments on commit c2721d0

Please sign in to comment.