Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100729 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40331 invoked from network); 21 Sep 2017 11:44:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Sep 2017 11:44:04 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; 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:56795] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/D1-62331-DF5A3C95 for ; Thu, 21 Sep 2017 07:44:03 -0400 Received: from [192.168.2.106] ([79.243.117.113]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0Lwnem-1dJWNu0sjw-016Odo for ; Thu, 21 Sep 2017 13:43:54 +0200 To: PHP internals Message-ID: <7cf5adb8-0738-259e-6d1e-f966722fdae2@gmx.de> Date: Thu, 21 Sep 2017 13:43:54 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:ZvJ7JsD5aA33FOGNEjml/6FTTBJdRux7Crv/8tt573vm0/f69gK PVBBANh1Rq5+IwoD97k3v7L1C9hQqvr/gKsyyIfDrsbdo5BlMZmEGBCOcwVYkjO8bDpCPkS N/SQPukg1u7hGTpGAvXDn9uck386ys9H2RnuYX58jY+E7grjQnpLkBnjn19kzuCgk/Z6XQx rFi2RSNojaWom0i6f8asg== X-UI-Out-Filterresults: notjunk:1;V01:K0:GxsD0M3ycJg=:oRbhiR3BJJ/hEiJKutYgSa vywfZgn15ACrpMybEdJUSJXKLqNiNKPuZ3QHk0UTt/6oipQ368OOLDePHEa2FrQlF7X0N9Mzg Gvp/swrYS6Cqc5juAvGNwgDxlR3oTArtz8F7zNhvKXfCUfETY6J/wFipzKeloWPnRO5vQJgq9 XT2jGJ8/MHGufZavyg+57ICxKjsDrP9CS099mpk1nUJPr0pVxpl3IamcHHZI+TEd+SsWC5u5i 4fm/wP9eQ42dB7aW5FwNlXnylVGPkneHxVpLMRRoOoR8AkoTZzPmN20yrxuh5Zbbg2FKt0OFn Rgm02hvQZ2bCDh6a8WOU+5S+Sr3fSfoPqtac9wvWZC0gvoWMw0lwjVNZ9S3jdPYnkOpmqDnXb JcJJc7b6vWzGCE2nBjoIXQ0hCGZE1oxi2XOGIEeORIFGP0CnrYvLipJre4Kv1hh8K/4Lgz5FA pKCSE8NZ57uPHXYqHqLQM7pYVQzkIdA+6VxbRWH567+h5XIDXRRUAc8Go4YC+3iaEoyUf8WM7 H4XhqgTG5jQEXUgvdcIrVeBeN4dQyKwjRa+AwbPUjk0XRdPBKSyD5vLjnzqoPc2Wq/ZXdDocB qTZJaeHszyNgoKLGWBMHhf2u+btgyKJLqZ9a+orZYX8zOe2Lk4ang2NCsq6k+bIMSuRcEdsKj Kmtr1fb/5kl7NKYWmmXDvfT2+NYpobtAm2oUEKWBbDlvtjLKXbC2g9eDlCHwD213dEMk6Q2mt jKCkANQa7YzonOGNipINYlLfVcLP/0VpJNALo95DwF9VMULYvdGxnb58FwKpSzxlo/Tv6vJ+v RYIEJp6RUibrN3DYVVyAsHca0j8XWThFcOTLnCacV/yVRhxakU= Subject: fputcsv() and $escape character From: cmbecker69@gmx.de ("Christoph M. Becker") Hi everybody! There are several bug reports regarding "broken" fputcsv() behavior in our tracker, namely, because the $escape parameter causes unexpected results. For instance: outputs "a\"",bbb instead of the expected "a\""",bbb I don't think the current behavior is a bug, but rather the escape character is an extension to the CSV "standard" (RFC 7111). One can practically disable the escape character by passing any character that is not contained in any of the strings in the array; "\0" is usually a good choice, so changing line 5 in the script above to the following gives the desired behavior: fputcsv($fp, $row, ',', '"', "\0"); Cf. vs. . It is, however, not possible to pass an empty string as $escape argument, because fputcsv() bails out in this case raising Warning: fputcsv(): escape must be a character I suggest to allow an empty string instead, and to consider making this the default in a future version, probably after some time of deprecating any other $escape argument. Thoughts? -- Christoph M. Becker