|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-06 16:22 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 08:00:01 2025 UTC |
Description: ------------ fputcsv() is behaving differently with different fields values. A string provided with a blank space gets enclosed by fputcsv but with other characters other than space are not enclosed. For details refer to the reproduce code and expected and actual output. Reproduce code: --------------- <?php $fh = fopen("file.tmp","w"); $field_array = array('abc,def'); $field_array2 = array('abc def'); var_dump( fputcsv($fh, $field_array, '+', '$') ); fclose($fh); var_dump( file_get_contents("file.tmp") ); unlink("file.tmp"); $fh = fopen("file2.tmp","w"); var_dump( fputcsv($fh, $field_array2, '+', '$') ); fclose($fh); var_dump( file_get_contents("file2.tmp") ); ?> Expected result: ---------------- int(8) string(8) "$abc,def$ " int(10) string(10) "$abc def$ " Actual result: -------------- int(8) string(8) "abc,def " int(10) string(10) "$abc def$ "