Skip to content

Parsing fails when processing incomplete CSV chunks #2

@clue

Description

@clue

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 👍

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