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 committed by Johannes Meyer
parent 9f14c32b71
commit 41a2aed0b5
1 changed files with 1 additions and 1 deletions

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";
}