|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33179 backslash is not an escape character in correct CSV
Submitted: 2005-05-30 02:22 UTC Modified: 2005-06-09 03:13 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: fsb at thefsb dot org Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.10 OS: os x 10.3 and freebsd 5.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: fsb at thefsb dot org
New email:
PHP Version: OS:


 [2005-05-30 02:22 UTC] fsb at thefsb dot org
why can i have a \ at the end of a field but not
if i wrap it in " field delimiters? e.g.

  abc,123\,abc       works fine but

  "abc","123\",abc   produces only two columns

this question has been asked before (#29278, #30476,
etc.) and rejects the bug as bogus. i 
don't agree. 

if this is not a bug then this unusual use of \ to 
escape only closing field delimiting double quotes 
but not escape any other instances of double qotes or 
(it would appear) any other character SHOULD be 
documented. it is not.

moreover this undocumented feature is not consistent 
with the specification of the CSV file format found 

this csv spec suggests that backslash has no special 
meaning in the CSV format at all. indeed, in all my 
tests, fgetcsv appears to accord it no special meaning 
_except_ in this one particular case.

such a surprising behaviour that deviates from common 
CSV file format conventions SHOULD be documented (or 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-31 01:18 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

As far as PHP is concerned backslash is an escape characte, which makes the demonstrated behaviour expected.
 [2005-06-01 02:25 UTC] fsb at thefsb dot org
if backslash were an escape character to PHP then it 
would not appear in the parsed values from the following 
csv file:

abc,\ 123,abc,123,abc,123
abc,123\ ,abc,123,abc,123
abc,123,"a""bc"\ ,123,abc,123

in every case above, the backslash preceeds a special 
caracter in the csv file format. if backshalsh were 
generally an escape character then in these positions it 
should be removed by the csv parser leaving the 
following character as literal.
 [2005-06-04 01:49 UTC] fsb at thefsb dot org
iliaa, please see my update from 6/1. i omitted to 
change the status to open when i submitted it.
 [2005-06-06 10:25 UTC]
Check you magic_quotes_* settings in php.ini..

 [2005-06-09 03:13 UTC] fsb at thefsb dot org

both are turned off.

since you changed the state back to bogus i assume that 
your note was not a request for more information about 
the bug. i suppose i should take the hint and just stop 
bothering people.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 04 19:01:16 2020 UTC