fix(csv): fix #5279 always force subject to be a string

When performing a str_replace, subject should always be a string. If
passing a non-existent column or empty column, subject may be null

This ensure str_replace is called when subject is actually a string (not
NULL)
This commit is contained in:
Yoda-BZH 2024-10-31 11:38:19 +01:00
parent 2864e60d78
commit 295d7290a4

View File

@ -37,7 +37,7 @@ class Csv
}
$out = array();
foreach ($row as & $val) {
$out[] = '"' . str_replace('"', '""', $val) . '"';
$out[] = '"' . ($val ? str_replace('"', '""', $val) : '') . '"';
}
$csv .= implode(',', $out) . "\r\n";
}