php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29278 fgetcsv() problems with \ at the end of a field
Submitted: 2004-07-20 12:59 UTC Modified: 2004-07-20 23:47 UTC
From: jens at girbert dot de Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.7 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jens at girbert dot de
New email:
PHP Version: OS:

 

 [2004-07-20 12:59 UTC] jens at girbert dot de
Description:
------------
When reading a comma separated file with fgetcsv, the function does not split the fields correctly in following conditions:

-backslash \ at the end of a field
and
-fields are enclosed by ""

the following line from the csv-file is read with a wrong result:

"test1\","test2","test3"

There are only 2 fields in the array returned by fgetcsv:

[0] => test1\",test2
[1] => test3

Expected is:

[0] => test1\
[1] => test2
[2] => test3



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-20 23:47 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Escaping " makes the parser skip over that character. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Apr 27 02:01:26 2025 UTC