Skip to content

Commit

Permalink
bug fix BOM stripping #184
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Oct 3, 2016
1 parent 3b22a40 commit d1b540d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All Notable changes to `Csv` will be documented in this file

## Next

### Added

- None

### Deprecated

- None

### Fixed

- BOM filtering fix [issue #184](ttps://github.com/thephpleague/csv/issues/184)

### Removed

- None

## 8.1.1 - 2016-09-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Modifier/QueryFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected function getStripBomIterator(Iterator $iterator)
}

$row[0] = mb_substr($row[0], $bom_length);
if ($row[0][0] === $enclosure && mb_substr($row[0], -1, 1) === $enclosure) {
if (mb_substr($row[0], 0, 1) === $enclosure && mb_substr($row[0], -1, 1) === $enclosure) {
$row[0] = mb_substr($row[0], 1, -1);
}

Expand Down
1 change: 0 additions & 1 deletion test/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ public function testEach()
$transform = [];
$this->csv->addFilter(function ($row) {
return $row != [null];

});
$res = $this->csv->each(function ($row) use (&$transform) {
$transform[] = array_map('strtoupper', $row);
Expand Down

0 comments on commit d1b540d

Please sign in to comment.