Skip to content

Infinite loop in APIData Source #13

@lyubo-slavilov

Description

@lyubo-slavilov

while (true) {
$data = $this->queryApi($apiOpenResult, $step);
if (empty($data)) break;
$step++;
// Send meta and data
// ...
if (is_array($data) && count($data) > 0) {
if (!$this->metaSent) {
$metaData = $this->metaData;
$row0 = $this->mapRow(array_values($data)[0]);
foreach ($row0 as $key => $value) {
$metaData["columns"][$key] = array(
"type" => $this->guessType($value),
);
}
$this->sendMeta($metaData, $this);
$this->metaSent = true;
$this->startInput(null);
}
foreach ($data as $row) {
$row = $this->mapRow($row);
$this->next($row);
}
}
}

The while loop never ends.
Caused by the check if (is_array($data) && count($data) > 0) which will never be evaluated to true because $data is always a string.

So currently APIDataSource is usless

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