From:             t dot meesters at triptic dot nl
Operating system: Linux-2.4
PHP version:      4.3.8
PHP Bug Type:     Filesystem function related
Bug description:  fgetcsv - double quotes issue

Description:
------------
The fgetcsv() of PHP 4.3.4 works fine, however, as of 4.3.8 the behaviour
concerning escaped string qualifiers changed.

With single line data, an initial escaped string qualifier doesn't get
noticed.
With multiple line data, the last occurrence of an escaped string
qualifier doesn't get noticed.

For the example code, use the following data:

-------------------------
CSV DATA (test.csv)
-------------------------
test;test spaced string;"test; with delimeter";"""test with inline double
quotes""";"test
with
newlines";"""test
with
newlines and double quotes"""


Reproduce code:
---------------
<?php

$f=fopen('test.csv','rb');
while (!feof($f)) {
    $s = fgetcsv($f,1000,';','"');
    print_r($s);
}
fclose($f);

?>


Expected result:
----------------
Array
(
    [0] => test
    [1] => test spaced string
    [2] => test; with delimeter
    [3] => "test with inline double quotes"
    [4] => test
with
newlines
    [5] => "test
with
newlines and double quotes"
)


Actual result:
--------------
Array
(
    [0] => test
    [1] => test spaced string
    [2] => test; with delimeter
    [3] => test with inline double quotes"
    [4] => test
with
newlines
    [5] => "test
with
newlines and double quotes
)


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

Reply via email to