#42202 [Opn->Csd]: fputcsv() inserts a new line character at the end of string

From: Date: Thu, 16 Aug 2007 09:01:03 +0000
Subject: #42202 [Opn->Csd]: fputcsv() inserts a new line character at the end of string
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969377506@lists.php.net to get a copy of this message
ID: 42202 Updated by: vrana@php.net Reported By: nikhil dot gupta at in dot ibm dot com -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Linux, Windows PHP Version: 5CVS-2007-08-03 (CVS) New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "fputcsv() formats a line as CSV and write it (terminated by a newline) to the specified file" Previous Comments: ------------------------------------------------------------------------ [2007-08-04 14:10:25] jani@php.net This is the correct behaviour. Reclassified as docu bug. ------------------------------------------------------------------------ [2007-08-03 12:13:34] nikhil dot gupta at in dot ibm dot com Description: ------------ fputcsv() inserts a newline character at the end of string. This behaviour is not seen in the documentation. This happens for both php5 and php6 on windows as well as on RHEL. Reproduce code: --------------- <?php $list = array ('aaa,bbb'); $fp = fopen("file.tmp", 'w'); var_dump(fputcsv($fp, $list)); var_dump( filesize("file.tmp") ); var_dump( file_get_contents("file.tmp") ); fclose($fp); ?> Expected result: ---------------- int(9) int(9) string(9) ""aaa,bbb"" Actual result: -------------- int(10) int(10) string(10) ""aaa,bbb" " ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42202&edit=1

« previous php.doc (#969377506) next »