ID: 44979
Updated by: [EMAIL PROTECTED]
Reported By: great_boba at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Suse
PHP Version: 5.2.6
New Comment:
This is expected. The "" is an escaped enclosure.
Using:
"A","B","C"
"A","B ""","C """
Array
(
[0] => A
[1] => B "
[2] => C "
)
Use a proper format file.
Previous Comments:
------------------------------------------------------------------------
[2008-05-13 10:32:21] great_boba at yahoo dot com
Description:
------------
I try to write some application which parse csv-dump.
Below I write little example to show strange things.
Reproduce code:
---------------
1.csv
"A","B","C"
"A","B "","C """
1.php
<?php
$fp=fopen('1.csv',r');
while($data=fgetcsv($fp,4096,','))
print_r($data);
fclose($fp);
?>
Expected result:
----------------
Array
{
[0]=>A
[1]=>B
[2]=>C
}
Array
{
[0]=>A
[1]=>B "
[2]=>C ""
}
Actual result:
--------------
Array
{
[0]=>A
[1]=>B
[2]=>C
}
Array
{
[0]=>A
[1]=>B ",C """
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44979&edit=1