#42167 [Opn]: fgetcsv gives different output on php6 compared to php5
| From: | msaraujo@php.net | Date: | Tue, 05 Feb 2008 15:44:24 +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-122001@lists.php.net to get a copy of this message | ||
ID: 42167
Updated by: msaraujo@php.net
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:
I have reproduced the code in PHP 6 and PHP 5.2.5, got the same
behavior as you got.
Previous Comments:
------------------------------------------------------------------------
[2007-08-06 13:14:47] nikhil dot gupta at in dot ibm dot com
There is a typo in the Description. Here is the correct one:
fgetcsv() gives different output on php6 compared to php5 on linux. The
output on php5 is correct.
------------------------------------------------------------------------
[2007-08-01 14:35:23] nikhil dot gupta at in dot ibm dot com
The same difference is observed on Windows also.
------------------------------------------------------------------------
[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