mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 00:36:38 +00:00
fixes unparse bug if no data for unparsing remain (comments #150)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user