#42167 [Opn]: fgetcsv gives different output on php6 compared to php5

From: Date: Wed, 01 Aug 2007 14:35:23 +0000
Subject: #42167 [Opn]: fgetcsv gives different output on php6 compared to php5
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115650@lists.php.net to get a copy of this message
ID: 42167 User updated by: nikhil dot gupta at in dot ibm dot com Reported By: nikhil dot gupta at in dot ibm dot com Status: Open Bug Type: Filesystem function related Operating System: Linux PHP Version: 6CVS-2007-08-01 (snap) New Comment: The same difference is observed on Windows also. Previous Comments: ------------------------------------------------------------------------ [2007-08-01 14:32:07] nikhil dot gupta at in dot ibm dot com Description: ------------ fgetcsv() gives different output on php6 compared to php6 on linux. Reproduce code: --------------- <?php $filename = dirname(__FILE__) . '/fgetcsv1.tmp'; $file_handle = fopen($filename, "w+" ); $delimiter = '\\'; $csv_field = 'water\\"fruit"\\"air"'; fwrite($file_handle, $csv_field . "\n"); rewind($file_handle); var_dump( fgetcsv($file_handle, 1024, $delimiter ) ); // close the file fclose($file_handle); //delete file unlink($filename); ?> Expected result: ---------------- according to php5 the output is: array(3) { [0]=> string(5) "water" [1]=> string(5) "fruit" [2]=> string(3) "air" } Actual result: -------------- Output on php6 is: array(1) { [0]=> string(19) "water\"fruit"\"air"" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42167&edit=1

« previous php.bugs (#115650) next »