From: tgallagher at kalos-inc dot com
Operating system: Windows 2000 Pro
PHP version: 4.3.4
PHP Bug Type: Filesystem function related
Bug description: fgetcsv error: tab delimited with backslash
Description:
Using this sample.txt file with fgetcsv (tab delimited)
9712211
950707\\
\\
999637ERYC 250
on the middle record I get instead of 3 records, I get 7.
instead of 3 records I get 2.
record 1 is read correctly, records 2 and 3 run together.
if I put a space at the beginning of the line with the double back slash
it works.
after searching the bug database I believe this error has not been
reported.
please correct me if this is not a bug.
Reproduce code:
---
?PHP
$fileHandle = fopen(sample.txt, r);
while ($data = @fgetcsv ($fileHandle, 5000, \t))
{
print_r($data);
}
?
Expected result:
Array
(
[0] =
[1] =
[2] = 971221
[3] = 1
)
Array
(
[0] =
[1] =
[2] = 950707
[3] = \\
\\
Array
(
[0] =
[1] =
[2] = 999637
[3] = ERYC 250
)
Actual result:
--
Array
(
[0] =
[1] =
[2] = 971221
[3] = 1
)
Array
(
[0] =
[1] =
[2] = 950707
[3] = \\
\\
[4] =
[5] = 999637
[6] = ERYC 250
)
--
Edit bug report at http://bugs.php.net/?id=26634edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26634r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26634r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26634r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26634r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26634r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26634r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26634r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=26634r=support
Expected behavior: http://bugs.php.net/fix.php?id=26634r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=26634r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=26634r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26634r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26634r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26634r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26634r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=26634r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26634r=float