Skip to content

Commit 956c4b3

Browse files
authored
Escape invalid characters
1 parent b87c79a commit 956c4b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Model/Import/FromCsv.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Opengento\CategoryImportExport\Model\Csv\Options;
1515

1616
use function array_combine;
17+
use function array_map;
1718
use function array_shift;
1819

1920
class FromCsv
@@ -38,7 +39,7 @@ public function execute(string $filePath, Options $options): void
3839
}
3940

4041
$rows = $this->csv->getData($filePath);
41-
$keys = array_shift($rows);
42+
$keys = array_map(static fn (string $key): string => preg_replace('/[^\w]/', '', $key), array_shift($rows));
4243

4344
$data = [];
4445
foreach ($rows as $row) {

0 commit comments

Comments
 (0)