From: nikhil dot gupta at in dot ibm dot com Operating system: Linux, Win32-xp PHP version: 5CVS-2007-08-05 (CVS) PHP Bug Type: Filesystem function related Bug description: fputcsv() not consistent to enclose with other than default enclosure value
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$ " -- Edit bug report at http://bugs.php.net/?id=42210&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42210&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42210&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42210&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42210&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42210&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42210&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42210&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42210&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42210&r=support Expected behavior: http://bugs.php.net/fix.php?id=42210&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42210&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42210&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42210&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42210&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42210&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42210&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42210&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42210&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42210&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42210&r=mysqlcfg