|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26915 fgetcsv and quoted enclosures
Submitted: 2004-01-15 05:21 UTC Modified: 2004-01-15 05:35 UTC
From: juergen at henge-ernst dot de Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.3.4 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
26 - 5 = ?
Subscribe to this entry?

 [2004-01-15 05:21 UTC] juergen at henge-ernst dot de
The following line in a csv-file does not get parsed correctly:

For me the csv format is defined as:
If a delimiter is used inside a string/entry, the entry must be enclosured with a character. If the encloure-character is used inside the entry, the enclosure character must be doubled.

maybe the fix of Bug #22382 "fgetcsv does not allow escaped quotes" introduced this behaviour.

With version 4.2.2, 4.2.3 the correct string is returned.

Reproduce code:
$str = '"one\""one","two\\\\two","three""three","four\""four"';
fputs($x, $str);
while ($y=fgetcsv($x,1000,","))

Expected result:
array(4) {
  string(5) "one\"one"
  string(8) "two\\two"
  string(11) "three"three"
  string(6) "four\"four"

Actual result:
array(4) {
  string(5) "one\""
  string(8) "two\\two"
  string(11) "three"three"
  string(6) "four\""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-15 05:35 UTC] juergen at henge-ernst dot de
ok seems to be fixed in php4-STABLE-200401150830
PHP 4.3.5RC2-dev (cli)
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jan 26 22:05:54 2023 UTC