From:             volf44 at yandex dot ru
Operating system: Linux, Windows 2k
PHP version:      4.3.10
PHP Bug Type:     *Programming Data Structures
Bug description:  fgetcsv() against double quote

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 bug report at http://bugs.php.net/?id=32717&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32717&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32717&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32717&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32717&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32717&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32717&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32717&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32717&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32717&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32717&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32717&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32717&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32717&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32717&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32717&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32717&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32717&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32717&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32717&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32717&r=mysqlcfg

Reply via email to