Skip to content

Error when getting Range for non-existent key - foreach() argument must be of type array|object, bool given #31

@texnicii

Description

@texnicii

RedisClient::executeCommand() uses Redis::rawCommand() and Redis::rawCommand() may return false. Therefore $rawResults may contains false and it will throws the error when false put to foreach

$rawResults = $this->redis->executeCommand(array_merge($params, $this->getAggregationParams($rule)));

$rawResults = $this->redis->executeCommand(array_merge($params, $this->getAggregationParams($rule)));

$samples = [];
foreach ($rawResults as $rawResult) {
    $samples[] = Sample::createFromTimestamp($key, (float)$rawResult[1], (int)$rawResult[0]);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions