Ignore:
Timestamp:
May 31, 2021 1:51:18 AM (3 years ago)
Author:
anonymous
Message:

Add brackets to avoid ambiguity in return value

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Utilities.inc.php

    r744 r746  
    16271627    $app =& App::getInstance();
    16281628
    1629     if (false === $resolved_filename = stream_resolve_include_path($filename)) {
     1629    if (false === ($resolved_filename = stream_resolve_include_path($filename))) {
    16301630        $app->logMsg(sprintf('JSON file "%s" not found in path "%s"', $filename, get_include_path()), LOG_ERR, __FILE__, __LINE__);
    16311631        return null;
     
    16371637    }
    16381638
    1639     if (null === $data = json_decode(file_get_contents($resolved_filename), $assoc, $depth, $options)) {
     1639    if (null === ($data = json_decode(file_get_contents($resolved_filename), $assoc, $depth, $options))) {
    16401640        $app->logMsg(sprintf('JSON is unparsable: %s', $resolved_filename), LOG_ERR, __FILE__, __LINE__);
    16411641        return null;
     
    17051705        return false;
    17061706    case -5:
    1707         $app->logMsg('IP Intelligence: Banned: no permission or invalid email address', LOG_WARNING, __FILE__, __LINE__);
     1707        $app->logMsg('IP Intelligence: Banned: exceeded query limits, no permission, or invalid email address', LOG_WARNING, __FILE__, __LINE__);
    17081708        return false;
    17091709    case -6:
     
    17111711        return false;
    17121712    default:
    1713         if (!is_numeric($response) || $response < 0 || $response >= $threshold) {
     1713        if (!is_numeric($response) || $response < 0) {
     1714            $app->logMsg(sprintf('IP Intelligence: Unknown status for IP (%s): %s', $response, $ip), LOG_NOTICE, __FILE__, __LINE__);
     1715            return false;
     1716        }
     1717        if ($response >= $threshold) {
    17141718            $app->logMsg(sprintf('IP Intelligence: Bad IP (%s): %s', $response, $ip), LOG_NOTICE, __FILE__, __LINE__);
    17151719            return true;
Note: See TracChangeset for help on using the changeset viewer.