php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54134 fputcsv $enclosure bug
Submitted: 2011-03-02 11:18 UTC Modified: 2011-03-06 03:17 UTC
From: vincent at vincen dot tk Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.3SVN-2011-03-02 (snap) OS: Windows 7
Private report: No CVE-ID: None
 [2011-03-02 11:18 UTC] vincent at vincen dot tk
Description:
------------
---
From manual page: http://www.php.net/function.fputcsv
---

fputcsv($fh, array $line, ";", '"');

this short samples provide us three double quotes (or none) around each elements 
of the array. 

Expected result:
----------------
i expected one double quotes around each elements.

Actual result:
--------------
this short samples provide us three double quotes (or none) around each elements 
of the array. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-04 10:40 UTC] carsten_sttgt at gmx dot de
> fputcsv($fh, array $line, ";", '"');
>
> this short samples provide us three double quotes (or none)
> around each elements of the array.

$line = 'foobar';
No need to enclose the field, because it doesn't contain reserved characters

$line = '"foobar"';
a) If the enclose character (") is used in the field, it have to be doubled ("")
--> ""foobar""
b) Contains a reserved character ("), so it have to be enclosed
--> """foobar"""

See RFC4180.
 [2011-03-06 03:17 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2011-03-06 03:17 UTC] felipe@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


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 23:01:26 2024 UTC