ID:               34824
 Updated by:       [EMAIL PROTECTED]
 Reported By:      decryptus at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: Linux debian
 PHP Version:      4.4.0
 New Comment:

The CSV file should contain 
foo|"foo_1\|foo_2"
if you want it to be parsed correctly.
Try with Excel/Spreadsheet and you'll get the same result.
No bug here.


Previous Comments:
------------------------------------------------------------------------

[2005-10-11 10:02:09] decryptus at gmail dot com

Description:
------------
The function fgetcsv has a problem when I parse a csv file.

If you parse a csv for example with delimeter pipe ("|") and you
backslashes a pipe, the function shouldn't take it that a delimeter.

Reproduce code:
---------------
csv_file.csv content:

foo|foo_1\|foo_2

----------------------------------
fgetcsv.php content:

<?php
        $handle = fopen('csv_file.csv','r');
        while(($line = fgetcsv($handle,1000,'|')) !== false)
        {
                print '<pre>'; print_r($line); print '</pre>';
        }
?>


Expected result:
----------------
Array
(
    [0] => foo
    [1] => foo_1|foo_2
)

Actual result:
--------------
Array
(
    [0] => foo
    [1] => foo_1\
    [2] => foo_2
)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34824&edit=1

Reply via email to