From: decryptus at gmail dot com
Operating system: Linux debian
PHP version: 4.4.0
PHP Bug Type: Filesystem function related
Bug description: Error in fgetcsv parsing with backslashes
Description:
------------
The function fgetcsv has a problem when I parse a csv file.
If you parse a csv for example with delimeter pipe ("|") and you
backslashes a pipe, the function shouldn't take it that a delimeter.
Reproduce code:
---------------
csv_file.csv content:
foo|foo_1\|foo_2
----------------------------------
fgetcsv.php content:
<?php
$handle = fopen('csv_file.csv','r');
while(($line = fgetcsv($handle,1000,'|')) !== false)
{
print '<pre>'; print_r($line); print '</pre>';
}
?>
Expected result:
----------------
Array
(
[0] => foo
[1] => foo_1|foo_2
)
Actual result:
--------------
Array
(
[0] => foo
[1] => foo_1\
[2] => foo_2
)
--
Edit bug report at http://bugs.php.net/?id=34824&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34824&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34824&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34824&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34824&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34824&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34824&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34824&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34824&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34824&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34824&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34824&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34824&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34824&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34824&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34824&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34824&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34824&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34824&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34824&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34824&r=mysqlcfg