Bug #74713 [Opn->Dup]: CSV cell split after fputcsv() + fgetcsv() round trip.

From: Date: Wed, 12 Sep 2018 22:53:36 +0000
Subject: Bug #74713 [Opn->Dup]: CSV cell split after fputcsv() + fgetcsv() round trip.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217020@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74713&edit=1 ID: 74713 Updated by: cmb@php.net Reported by: andreas at dqxtech dot net Summary: CSV cell split after fputcsv() + fgetcsv() round trip. -Status: Open +Status: Duplicate Type: Bug Package: Filesystem function related Operating System: Linux / 3v4l PHP Version: 7.1.5 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Well, it seems we agree that we can't fix the current behavior for BC reasons, and that the best way to move on is to allow an empty string as escape parameter for fgetcsv(), fputcsv() and friends, so that the whole escaping stuff is ignored/omitted. Then we're left with this ticket being a duplicate of request #38301 and request #51496, respectively. Previous Comments: ------------------------------------------------------------------------ [2018-09-10 16:17:08] theodorejb at outlook dot com This is still a serious issue which I've run into, and it even affects popular libraries such as League/CSV. See the discussion on PHP internals here: https://externals.io/message/100729#103145. Would it be possible to move forward with allowing a blank string to be passed to fputcsv() to fix this? To me the fact that fputcsv() doesn't support a blank string for the escape character should be treated as a bug - an RFC should only be needed if we want to change the default behavior in PHP 8. ------------------------------------------------------------------------ [2017-09-21 16:48:38] cmb@php.net > So how could we achieve this? Do we need an RFC for this? I've already sent a respective mail to the internals list[1]. If there'll be no massive objections, I'm planning to pursue the RFC process. [1] <http://news.php.net/php.internals/100729> ------------------------------------------------------------------------ [2017-09-21 16:09:45] andreas at dqxtech dot net > It would be better, though, if one could pass an empty > string or maybe NULL, and perhaps to make that the default in PHP 8. Yes. So how could we achieve this? Do we need an RFC for this? ------------------------------------------------------------------------ [2017-09-21 11:27:31] cmb@php.net > Sorry, but "use a user land parser because someone may rely on buggy behavior > hence we keep" is a bad attitude Well, this is not really a bug, but rather related to the escape character, which is a non-standard extension. Removing the escape character may very well cause a BC break for applications relying on it. Anyhow, currently, a quite acceptable workaround is to pass "\0" as $escape argument to fputcsv(). It would be better, though, if one could pass an empty string or maybe NULL, and perhaps to make that the default in PHP 8. ------------------------------------------------------------------------ [2017-06-12 07:06:32] spam2 at rhsoft dot net Sorry, but "use a user land parser because someone may rely on buggy behavior hence we keep" is a bad attitude ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=74713 -- Edit this bug report at https://bugs.php.net/bug.php?id=74713&edit=1

« previous php.bugs (#217020) next »