Fixed parse()'s return value: return true only if $data is useful

This commit is contained in:
Fonata
2018-03-17 12:01:45 +01:00
parent 10895788c8
commit c8d15557cb

View File

@@ -369,13 +369,11 @@ class Csv {
} }
if (empty($input)) { if (empty($input)) {
// todo: but why true? return false;
return true;
} }
$this->init($offset, $limit, $conditions); $this->init($offset, $limit, $conditions);
if (strlen($input) <= PHP_MAXPATHLEN && is_readable($input)) { if (strlen($input) <= PHP_MAXPATHLEN && is_readable($input)) {
$this->file = $input; $this->file = $input;
$this->data = $this->parse_file(); $this->data = $this->parse_file();
@@ -385,12 +383,7 @@ class Csv {
$this->data = $this->parse_string(); $this->data = $this->parse_string();
} }
if ($this->data === false) { return $this->data !== false;
return false;
}
return true;
} }
/** /**