From:             tgallagher at kalos-inc dot com
Operating system: Windows 2000 Pro
PHP version:      4.3.4
PHP Bug Type:     Filesystem function related
Bug description:  fgetcsv error: tab delimited with backslash

Description:
------------
Using this sample.txt file with fgetcsv (tab delimited)

" "     ""      "971221"        "1"
" "     ""      "950707"        "\\
\\"
" "     ""      "999637"        "ERYC 250"

on the middle record I get instead of 3 records, I get 7.
instead of 3 records I get 2.
record 1 is read correctly, records 2 and 3 run together.

if I put a space at the beginning of the line with the double back slash
it works.

after searching the bug database I believe this error has not been
reported.
please correct me if this is not a bug.

Reproduce code:
---------------
<?PHP

$fileHandle = fopen("sample.txt", "r");
while ($data = @fgetcsv ($fileHandle, 5000, "\t"))
{
    print_r($data);
}

?>

Expected result:
----------------
Array
(
    [0] =>  
    [1] => 
    [2] => 971221
    [3] => 1
)
Array
(
    [0] =>  
    [1] => 
    [2] => 950707
    [3] => \\

\\"
Array
(
    [0] => 
    [1] => 
    [2] => 999637
    [3] => ERYC 250
)

Actual result:
--------------
Array
(
    [0] =>  
    [1] => 
    [2] => 971221
    [3] => 1
)
Array
(
    [0] =>  
    [1] => 
    [2] => 950707
    [3] => \\
\\"


    [4] => 
    [5] => 999637
    [6] => ERYC 250
)

-- 
Edit bug report at http://bugs.php.net/?id=26634&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26634&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26634&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26634&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26634&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26634&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26634&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26634&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26634&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26634&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26634&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26634&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26634&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26634&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26634&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26634&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26634&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26634&r=float

Reply via email to