Skip to content

Commit b7fe4ab

Browse files
author
Chris Kacerguis
committed
resolves #235
1 parent 4d767cb commit b7fe4ab

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

application/libraries/Format.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,13 @@ public function to_csv()
200200
$output = '"'.implode('","', $headings).'"'.PHP_EOL;
201201
foreach ($data as &$row)
202202
{
203-
$row = str_replace('"', '""', $row); // Escape dbl quotes per RFC 4180
204-
$output .= '"'.implode('","', $row).'"'.PHP_EOL;
203+
if (is_array($row)) {
204+
throw new Exception('Format class does not support multi-dimensional arrays');
205+
} else {
206+
$row = str_replace('"', '""', $row); // Escape dbl quotes per RFC 4180
207+
$output .= '"'.implode('","', $row).'"'.PHP_EOL;
208+
}
209+
205210
}
206211

207212
return $output;

0 commit comments

Comments
 (0)