Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79046 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8200 invoked from network); 20 Nov 2014 18:14:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Nov 2014 18:14:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.21 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.21 mout.gmx.net Received: from [212.227.17.21] ([212.227.17.21:60330] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/00-07686-B9F2E645 for ; Thu, 20 Nov 2014 13:14:52 -0500 Received: from [192.168.0.100] ([91.67.244.80]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0Lm7MT-1YR7zF1h3Z-00ZhRo; Thu, 20 Nov 2014 19:14:48 +0100 Message-ID: <546E2FA1.1010006@gmx.de> Date: Thu, 20 Nov 2014 19:14:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Tjerk Meesters CC: PHP Internals References: <82139FDD-8D8B-43D9-B811-ECC1FFE6E8A6@gmail.com> <546CC4C8.7010001@gmx.de> <8E49EAC8-3681-4E36-BDAD-163D292193DD@gmail.com> In-Reply-To: <8E49EAC8-3681-4E36-BDAD-163D292193DD@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:V2ELhQswr0d5slcqDI7H92EAp/5YAYtKvs5eT4BOPzSuFD4Tw4m hY9KRgT73N94DA6COv3WfopN3j9b5QzOmmPktHel/ck89IDhR6p0xr8WS5Vpw3grrND47Rv GFE7AqVAtHmbxr533dpChlZsC4LLPAm0uZ5qV4kFFeG61UnMvotB+/7UyDc1jx/GTJp+nsy NeprnglBgCW1a21pSN55g== X-UI-Out-Filterresults: notjunk:1; Subject: Re: fgetcsv incompatible with fputcsv From: cmbecker69@gmx.de (Christoph Becker) Tjerk Meesters wrote: >> On 20 Nov 2014, at 00:26, Christoph Becker wrote: >> >> Are you aware of ? It seems this >> very inconsistency has been reported a few years ago, but has been >> tagged as "Wont fix" back then. > > Actually that bug report seems to suggest that fputcsv() uses backslash to encode enclosure characters, but AFAICT it doesn’t. Apparently, there is a somewhat hidden bug, see for a simplified test script. The expected result is string(14) ""a""b","a\""b"" or maybe string(14) ""a\"b","a\\"b"" The actual result makes no sense to me, even though str_getcsv() parses it "correctly". > And then there are bug reports like https://bugs.php.net/bug.php?id=67566 which were fixed but really just made the situation worse =( ACK. >> also seems to deal with this >> inconsistency, and had been tagged as "Not a bug". >> >> So maybe an RFC is appropriate? > > Yeah, I didn’t realise the can of worms until I opened it; I’ll round up all the bug reports and run them against whatever RFC I can get my hands on. > > PS: Favourite quote from the semi-authoritative spec of Perl_CSV: http://rath.ca/Misc/Perl_CSV/CSV-2.0.html#csv: > >> Given that the essence of CSV files is simplicity, I have decided to reject all escape and escaped characters with the exception of quoation marks appearing within quotation marks … > > Good times :) One might argue that the essence of CSV files is being a data exchange format, so applying Postel's law would be reasonable. :) -- Christoph M. Becker