#29719 [Opn->Csd]: fgetcsv - double quotes issue
| From: | iliaa@php.net | Date: | Tue, 17 Aug 2004 14:10:15 +0000 |
| Subject: | #29719 [Opn->Csd]: fgetcsv - double quotes issue | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-64794@lists.php.net to get a copy of this message | ||
ID: 29719
Updated by: iliaa@php.net
Reported By: t dot meesters at triptic dot nl
-Status: Open
+Status: Closed
Bug Type: Filesystem function related
Operating System: Linux-2.4
PHP Version: 4.3.8
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:
------------------------------------------------------------------------
[2004-08-17 14:25:30] t dot meesters at triptic dot nl
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 this bug report at http://bugs.php.net/?id=29719&edit=1