#42167 [Opn->Csd]: fgetcsv gives different output on php6 compared to php5
| From: | felipe@php.net | Date: | Wed, 06 Feb 2008 02:58:33 +0000 |
| Subject: | #42167 [Opn->Csd]: fgetcsv gives different output on php6 compared to php5 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-122022@lists.php.net to get a copy of this message | ||
ID: 42167
Updated by: felipe@php.net
Reported By: nikhil dot gupta at in dot ibm dot com
-Status: Open
+Status: Closed
Bug Type: Filesystem function related
Operating System: Linux
PHP Version: 6CVS-2007-08-01 (snap)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-02-05 15:44:22] msaraujo@php.net
I have reproduced the code in PHP 6 and PHP 5.2.5, got the same
behavior as you got.
------------------------------------------------------------------------
[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