Problem/Motivation

When using PHP 8.2 and the latest version of league/csv, an error is thrown due to the array structure of the header.

Steps to reproduce

Enable php 8.2
create a simple csv with a header row and a single record
Attempt to import
Observe the error in the database logs like:

League\Csv\SyntaxError: The header mapper indexes should only contain positive integer or 0. in League\Csv\Reader->computeHeader() (line 448 of vendor/league/csv/src/Reader.php).

Proposed resolution

Check for the header first. Same fix as in the CSV source: https://www.drupal.org/project/migrate_source_csv/issues/3406342

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dave.mentens created an issue. See original summary.

dave.mentens’s picture

Status: Active » Needs review
dave.mentens’s picture

Assigned: dave.mentens » Unassigned

  • d5916788 committed on 1.0.x
    Issue #3501715: Correct header array for league/csv and PHP 8.2.
    
ajits’s picture

Status: Needs review » Fixed

Thank you! Merged.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.