Skip to content

TabularDataReader::getRecords()->current() can return NULL #514

@josefsabl

Description

@josefsabl

Bug Report

Information Description
Version 9.12.0
PHP version 8.3.1
OS Platform Alpine Linux

Summary

In 9.12.0 the \League\Csv\Statement::create()->process('...')->getRecords()->current() started to return NULL even if the records is not empty.

Iterating over iterator works as expected.

Standalone code, or other way to reproduce the problem

var_dump(
    $records = \League\Csv\Statement::create()
        ->process(
            \League\Csv\Reader::createFromString(
                'hello;world'
            )
                ->setDelimiter(';')
        )
        ->getRecords()
        ->current()
);

Expected result

Version <9.11.0 prints:

array(2) {
  [0]=>
  string(5) "hello"
  [1]=>
  string(5) "world"
}

Actual result

Version >=9.12.0 (including master) prints:

NULL

Checks before submitting

  • Be sure that there isn't already an issue about this. See: Issues list
  • Be sure that there isn't already a pull request about this. See: Pull requests
  • I have added every step to reproduce the bug.
  • If possible I added relevant code examples.
  • This issue is about 1 bug and nothing more.
  • The issue has a descriptive title. For example: "JSON rendering failed on Windows for filenames with space".

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions