Req #42357 [Opn->Csd]: Add optional parameter for custom line ending to fputcsv()
Edit report at https://bugs.php.net/bug.php?id=42357&edit=1
ID: 42357
Updated by: girgias@php.net
Reported by: php at phihag dot de
-Summary: add optional parameter for line ending to fputcsv
+Summary: Add optional parameter for custom line ending to
fputcsv()
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Filesystem function related
PHP Version: 5.2.4RC2
-Assigned To:
+Assigned To: girgias
Block user comment: N
Private report: N
New Comment:
This has been added into PHP 8.1, see https://github.com/php/php-src/commit/5b29eba7ca1591438639010c75efecc11115a292
Previous Comments:
------------------------------------------------------------------------
[2020-03-30 16:58:27] cmb@php.net
Related To: Bug #46367
------------------------------------------------------------------------
[2020-03-30 16:58:10] cmb@php.net
Related To: Bug #62770
------------------------------------------------------------------------
[2016-10-25 17:57:57] cmb@php.net
> Small correction of the original bug report: \n is always used,
> [â¦]
Indeed[1], and this is actually a bug. RFC 4180[2] states:
> Each record is located on a separate line, delimited by a line
> break (CRLF).
[1] <https://github.com/php/php-src/blob/PHP-7.0.12/ext/standard/file.c#L1927>
[2] <https://tools.ietf.org/html/rfc4180>
------------------------------------------------------------------------
[2007-08-22 16:25:19] php at phihag dot de
No, same behavior (tested on Linux).
From php.net/fopen:
*Windows* offers a text-mode translation flag ('t') ...
Small correction of the original bug report: \n is always used, have a look at
ext/standard/file.c:~1991:
(...)
smart_str_appendc(&csvline, '\n');
smart_str_0(&csvline);
(...)
------------------------------------------------------------------------
[2007-08-21 06:20:27] derick@php.net
Does it work if you open the file in text mode ("wt") ? That *should* do the trick.
------------------------------------------------------------------------
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=42357
--
Edit this bug report at https://bugs.php.net/bug.php?id=42357&edit=1
Thread (5 messages)