mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Fixed parse()'s return value: return true only if $data is useful
This commit is contained in:
11
src/Csv.php
11
src/Csv.php
@@ -369,13 +369,11 @@ class Csv {
|
||||
}
|
||||
|
||||
if (empty($input)) {
|
||||
// todo: but why true?
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->init($offset, $limit, $conditions);
|
||||
|
||||
|
||||
if (strlen($input) <= PHP_MAXPATHLEN && is_readable($input)) {
|
||||
$this->file = $input;
|
||||
$this->data = $this->parse_file();
|
||||
@@ -385,12 +383,7 @@ class Csv {
|
||||
$this->data = $this->parse_string();
|
||||
}
|
||||
|
||||
if ($this->data === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
return $this->data !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user