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

From: Date: Sat, 04 Aug 2007 14:10:26 +0000
Subject: #42202 [Opn]: fputcsv() inserts a new line character at the end of string
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969377232@lists.php.net to get a copy of this message
ID: 42202 Updated by: jani@php.net Reported By: nikhil dot gupta at in dot ibm dot com Status: Open -Bug Type: Filesystem function related +Bug Type: Documentation problem Operating System: Linux, Windows PHP Version: 5CVS-2007-08-03 (CVS) New Comment: This is the correct behaviour. Reclassified as docu bug. Previous Comments: ------------------------------------------------------------------------ [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 (#969377232) next »