From 1c3baeb35f19442194feaed25b230f54d9e877d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilius=20=C5=A0umskas?= Date: Fri, 25 Feb 2022 12:01:31 +0200 Subject: [PATCH] Fixed issue: Survey participant data with quotes is not properly exported to CSV (#2073) --- application/helpers/export_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/helpers/export_helper.php b/application/helpers/export_helper.php index 90a9d9b38bc..165cac9e94a 100644 --- a/application/helpers/export_helper.php +++ b/application/helpers/export_helper.php @@ -2241,8 +2241,8 @@ function tokensExport($iSurveyID) } $tokenoutput .= '"'.trim($brow['tid']).'",'; - $tokenoutput .= '"'.trim($brow['firstname']).'",'; - $tokenoutput .= '"'.trim($brow['lastname']).'",'; + $tokenoutput .= '"'.str_replace('"', '""', trim($brow['firstname'])).'",'; + $tokenoutput .= '"'.str_replace('"', '""', trim($brow['lastname'])).'",'; $tokenoutput .= '"'.trim($brow['email']).'",'; $tokenoutput .= '"'.trim($brow['emailstatus']).'",'; $tokenoutput .= '"'.trim($brow['token']).'",'; @@ -2258,7 +2258,7 @@ function tokensExport($iSurveyID) $tokenoutput .= '"'.trim($brow['started']).'",'; } foreach ($attrfieldnames as $attr_name) { - $tokenoutput .= '"'.trim($brow[$attr_name]).'",'; + $tokenoutput .= '"'.str_replace('"', '""', trim($brow[$attr_name])).'",'; } $tokenoutput = substr($tokenoutput, 0, -1); // remove last comma $tokenoutput .= "\n";