CodeIgniter Forums
dbutil->csv_from_result bug - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: dbutil->csv_from_result bug (/showthread.php?tid=61810)



dbutil->csv_from_result bug - titaniumtroop - 05-19-2015

The code for the csv export has a bug concerning the trimming of the last delimiter on a line.

The code
PHP Code:
$out substr(rtrim($out), 0, -strlen($delim)).$newline
first trims the last character, and then also deletes the number of characters from the end of the string corresponding to the length of the delimiter. This deletes an extra character at the end of the line.

The correct code should be:
PHP Code:
$out substr($out0, -strlen($delim)).$newline



RE: dbutil->csv_from_result bug - Narf - 05-20-2015

https://github.com/bcit-ci/CodeIgniter/commit/b8cd5e657363795f127ae5e02e69972627b3fe9c

Thanks for reporting this.


RE: dbutil->csv_from_result bug - titaniumtroop - 05-20-2015

No problem. Thanks for committing the change.