#32717 [Opn->Bgs]: fgetcsv() against double quote
ID: 32717
Updated by: iliaa@php.net
Reported By: volf44 at yandex dot ru
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Linux, Windows 2k
PHP Version: 4.3.11
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is to be expected, quoted text can contain new lines, so "4 will
continue until the closing quote is found.
Previous Comments:
------------------------------------------------------------------------
[2005-04-15 13:56:55] volf44 at yandex dot ru
Description:
------------
fgetcsv() incorrect handles single double quote
in first position of the last record field.
Reproduce code:
---------------
file test.csv:
one|record with bad double quote|"4
two|record with good "|4
[EOF]
$fd = fopen( 'test.csv', 'rb' );
while( $rec = fgetcsv( $fd, 20480, '|' )){
var_dump( $rec );
}
Expected result:
----------------
array(3) {
[0]=>
string(3) "one"
[1]=>
string(28) "record with bad double quote"
[2]=>
string(1) ""4"
}
array(3) {
[0]=>
string(3) "two"
[1]=>
string(18) "record with good ""
[2]=>
string(1) "4"
}
Actual result:
--------------
array(4) {
[0]=>
string(3) "one"
[1]=>
string(28) "record with bad double quote"
[2]=>
string(24) "4
two|record with good "
[3]=>
string(1) "4"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32717&edit=1
Thread (6 messages)