From 189746405f7cfcfb25ba7c57019b33de7b7757f0 Mon Sep 17 00:00:00 2001 From: Jan Piskvor Martinec Date: Mon, 31 Oct 2016 11:22:32 +0100 Subject: [PATCH] Do not force filename if not set explicitly Per docblock, the function output() is supposed to output to browser only if filename is passed into it. If not, it should return the CSV as a string, not auto-set filename. --- parsecsv.lib.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/parsecsv.lib.php b/parsecsv.lib.php index d327bc3..1660a69 100644 --- a/parsecsv.lib.php +++ b/parsecsv.lib.php @@ -448,17 +448,14 @@ class parseCSV { * Generate a CSV based string for output. * * @access public - * @param [string] $filename If specified, headers and data will be output directly to browser as a downloable file + * @param [string] $filename If specified, headers and data will be output directly to browser as a downloadable file * @param [array] $data 2D array with data * @param [array] $fields Field names * @param [type] $delimiter delimiter used to separate data * - * @return [string] + * @return [string] the resulting CSV string */ public function output($filename = null, $data = array(), $fields = array(), $delimiter = null) { - if (empty($filename)) { - $filename = $this->output_filename; - } if ($delimiter === null) { $delimiter = $this->output_delimiter;