php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31580 fgetcsv: yet another doubled quote problem
Submitted: 2005-01-17 03:04 UTC Modified: 2005-01-18 01:15 UTC
From: rochkind at basepath dot com Assigned: iliaa (profile)
Status: Closed Package: Filesystem function related
PHP Version: 4.3.10 OS: Gentoo Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rochkind at basepath dot com
New email:
PHP Version: OS:

 

 [2005-01-17 03:04 UTC] rochkind at basepath dot com
Description:
------------
Can't handle doubled-quote at the start of a quoted field when there is another field following.

That is, does OK on the line:

z,"""x"

but not on the line:

z,"""x",yyy


Reproduce code:
---------------
<?php
	$out = fopen("/tmp/csv", "w");
	fputs($out, 'z,"""x"' . "\n");
	fputs($out, 'z,"""x",yyy' . "\n");
	fclose($out);
	echo "<pre>";
	system("cat /tmp/csv");
	echo "</pre>";
	$in = fopen("/tmp/csv", "r");
	while ($a = fgetcsv($in, 200))
		echo "<br>" . htmlspecialchars($a[1]);
	fclose($in);
?>



Expected result:
----------------
z,"""x"
z,"""x",yyy


"x
"x

Actual result:
--------------
z,"""x"
z,"""x",yyy


"x
x

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-17 18:43 UTC] sniper@php.net
See also bug #31074

 [2005-01-18 01:15 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2005-01-18 01:15 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC