From: rochkind at basepath dot com
Operating system: Gentoo Linux
PHP version: 4.3.10
PHP Bug Type: Filesystem function related
Bug description: fgetcsv: yet another doubled quote problem
Description:
------------
Can't handle doubled-quote at the start of a quoted field when there is
another field following.
That is, does OK on the line:
z,"""x"
but not on the line:
z,"""x",yyy
Reproduce code:
---------------
<?php
$out = fopen("/tmp/csv", "w");
fputs($out, 'z,"""x"' . "\n");
fputs($out, 'z,"""x",yyy' . "\n");
fclose($out);
echo "<pre>";
system("cat /tmp/csv");
echo "</pre>";
$in = fopen("/tmp/csv", "r");
while ($a = fgetcsv($in, 200))
echo "<br>" . htmlspecialchars($a[1]);
fclose($in);
?>
Expected result:
----------------
z,"""x"
z,"""x",yyy
"x
"x
Actual result:
--------------
z,"""x"
z,"""x",yyy
"x
x
--
Edit bug report at http://bugs.php.net/?id=31580&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31580&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31580&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31580&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31580&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31580&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31580&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31580&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31580&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31580&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31580&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31580&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31580&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31580&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31580&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31580&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31580&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31580&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31580&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31580&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31580&r=mysqlcfg