From: [EMAIL PROTECTED]
Operating system: RedHat Linux 6.2
PHP version: 4.3.0RC2
PHP Bug Type: Unknown/Other Function
Bug description: fgetcsv() cannot handle multi-line input
fgetcsv() was able to read multi-line fields that were quoted. Here is the
example of the test file:
f1;f2;f3
Test 1a;Test 1b;Test 1c
Test 2a;"Test 2b - line 1
Test 2b - line 2
Test 2b - line 3";Test 2c
We are trying to parse this file with the following code:
$f = @fopen($argv[1], "r");
if (!$f) exit("Cannot open input file.\n");
$v = array();
while ($data = fgetcsv ($f, 10000, ";"))
{
$v[] = $data;
}
var_export($v);
Now, in PHP 4.2.3 and earlier this produces correct 3 element array. PHP
4.3.0-dev produces 5 element array because it gets confused with the
multiple line input in the 2b field.
--
Edit bug report at http://bugs.php.net/?id=20716&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20716&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20716&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20716&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20716&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20716&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20716&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20716&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20716&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20716&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20716&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20716&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20716&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20716&r=isapi