fixes unparse bug if no data for unparsing remain (comments #150)

This commit is contained in:
Susann Sgorzaly
2018-11-13 19:10:10 +01:00
committed by Fonata
parent ab9e8a0af9
commit 52ad56c66a
2 changed files with 9 additions and 2 deletions

View File

@@ -848,8 +848,8 @@ class Csv {
// this is needed because sometime titles property is overwritten instead of using fields parameter!
$titlesOnParse = !empty($this->data) ? array_keys(reset($this->data)) : array();
// both are identical, also in ordering
if (array_values($fields) === array_values($titlesOnParse)) {
// both are identical, also in ordering OR we have no data (only titles)
if (empty($titlesOnParse) || array_values($fields) === array_values($titlesOnParse)) {
return array_combine($fields, $fields);
}