mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 00:36:38 +00:00
Bugfix: $csv->parseFile now sets $this->data
This adds consistency because $csv->parse() does the same. Fix #200 Fix #201
This commit is contained in:
@@ -1,3 +1,16 @@
|
|||||||
|
ParseCSV 1.3.1
|
||||||
|
-----------------------------------
|
||||||
|
Date: to be released
|
||||||
|
|
||||||
|
Bugfix:
|
||||||
|
- `parseFile()` will now set `$csv->data`.
|
||||||
|
Until now, the parsed data was only returned.
|
||||||
|
This adds consistency with `$csv->parse()`
|
||||||
|
for the following operations on the object.
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
ParseCSV 1.3.0
|
ParseCSV 1.3.0
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
Date: 14-Apr-2021
|
Date: 14-Apr-2021
|
||||||
|
|||||||
@@ -621,7 +621,10 @@ class Csv {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !empty($this->file_data) ? $this->_parse_string() : false;
|
if (empty($this->file_data)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $this->data = $this->_parse_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -331,4 +331,10 @@ class ParseTest extends TestCase {
|
|||||||
self::assertFalse($this->csv->parseFile(''));
|
self::assertFalse($this->csv->parseFile(''));
|
||||||
self::assertFalse($this->csv->parseFile(null));
|
self::assertFalse($this->csv->parseFile(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testParseFile() {
|
||||||
|
$data = $this->csv->parseFile(__DIR__ . '/fixtures/auto-double-enclosure.csv');
|
||||||
|
self::assertCount(2, $data);
|
||||||
|
self::assertEquals($data, $this->csv->data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user