Skip to content

Commit

Permalink
[BUGFIX] Do not consider "0" as empty in the CSV DB import
Browse files Browse the repository at this point in the history
A DB column value "0" is a perfectly valid value and should not be
considered to be empty.

Particularly, having a "0" value as the first value in a DB row
in a CSV file should still allow the DB row to get importet.

(In general, `empty()` in PHP behaves in mysterious ways and should
be avoided in favor of more explicit and human-predicable checks.)

Fixes #488

Releases: main, 7, 6
  • Loading branch information
oliverklee authored and lolli42 committed Aug 12, 2023
1 parent 258b9fc commit 66141bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/Core/Functional/Framework/DataHandling/DataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ protected static function parseData(array $rawData, string $fileName, bool $chec
$fieldCount = null;
$idIndex = null;
$hashIndex = null;
} elseif ($tableName !== null && !empty($values[1])) {
} elseif ($tableName !== null && (string)$values[1] !== '') {
array_shift($values);
if (!isset($data[$tableName]['fields'])) {
$data[$tableName]['fields'] = [];
foreach ($values as $value) {
if (empty($value)) {
if ((string)$value === '') {
continue;
}
$data[$tableName]['fields'][] = $value;
Expand Down

0 comments on commit 66141bd

Please sign in to comment.