When using a column (by referencing its header name) which is positioned directly before another column with an empty header cell, row data from the latter column is returned instead of from the former.
This is due to $value not being reset in getHeaders().
Please see attached patch for a fix.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

woutgg created an issue. See original summary.

claudiu.cristea’s picture

Issue tags: +Needs tests

I don't get your case. Let's add a test case in `\Drupal\Tests\migrate_spreadsheet\Unit\SpreadsheetIteratorTest` that proves the bug.

claudiu.cristea’s picture

Status: Active » Needs work
woutgg’s picture

The attached patch extends the unit tests to cover this issue.

It adds a column G (leaving F undefined) and extends the rows. The tests have only been changed to reflect these worksheet additions.

The non-existing column reflects how phpspreadsheet behaves, at least when given a CSV file with an empty header column, e.g.:
a,b,c,d,e,,g.

claudiu.cristea’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: migrate_spreadsheet-missing_column_test-2914156-8.x.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

claudiu.cristea’s picture

Status: Needs work » Needs review
FileSize
3.87 KB
3.19 KB

Rerolled, reworked a little bit the test.

claudiu.cristea’s picture

Issue tags: -Needs tests

Status: Needs review » Needs work

The last submitted patch, 7: 2914156-7-test-only.patch, failed testing. View results

  • claudiu.cristea committed 3c8ff6e on 8.x-1.x
    Issue #2914156 by claudiu.cristea, woutgg: Wrong data returned for...
claudiu.cristea’s picture

Status: Needs work » Fixed

Thank you for reporting & patch. Fixed.

Status: Fixed » Closed (fixed)

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