#26634 [Opn]: fgetcsv error: tab delimited with backslash
| From: | tgallagher at kalos-inc dot com | Date: | Mon, 15 Dec 2003 17:59:54 +0000 |
| Subject: | #26634 [Opn]: fgetcsv error: tab delimited with backslash | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52110@lists.php.net to get a copy of this message | ||
ID: 26634
User updated by: tgallagher at kalos-inc dot com
Reported By: tgallagher at kalos-inc dot com
Status: Open
Bug Type: Filesystem function related
Operating System: Windows 2000 Pro
PHP Version: 4.3.4
New Comment:
clairification:
on the middle record I get 7 fields: expected 3.
Previous Comments:
------------------------------------------------------------------------
[2003-12-15 12:58:08] tgallagher at kalos-inc dot com
Description:
------------
Using this sample.txt file with fgetcsv (tab delimited)
" " "" "971221" "1"
" " "" "950707" "\\
\\"
" " "" "999637" "ERYC 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 this bug report at http://bugs.php.net/?id=26634&edit=1