When streaming a (larger) CSV file, the file contents will be read in chunks and will then be processed by the Reader. The Reader currently resets the buffer position to the beginning of the buffer and the next chunk will thus overwrite the existing, incomplete buffer here:
|
public function handleData($data) |
|
{ |
|
fputs($this->buffer, $data); |
|
$this->parseBuffer(); |
|
} |
|
|
|
/** |
|
* Tries to parse the buffer and emits header- or data-events. |
|
* |
|
* @return void |
|
*/ |
|
public function parseBuffer() |
|
{ |
|
rewind($this->buffer); |
While it looks like this should be relatively easy to fix, this project does unfortunately not currently contain a test suite. As such, I'm only reporting this here in the hope that somebody else has a chance to look into this 👍
When streaming a (larger) CSV file, the file contents will be read in chunks and will then be processed by the
Reader. TheReadercurrently resets the buffer position to the beginning of the buffer and the next chunk will thus overwrite the existing, incomplete buffer here:reactphp-csv/src/Reader.php
Lines 60 to 73 in c438430
While it looks like this should be relatively easy to fix, this project does unfortunately not currently contain a test suite. As such, I'm only reporting this here in the hope that somebody else has a chance to look into this 👍