[PHP-DEV] Enhancement to fputcsv

2021-03-18 Thread Cameron Hall
Hi internals,

I sent an email[1] to the list about this in November, which didn't gain
much traction.

I've created a pull request[2] which adds an optional parameter for
line endings to the fputcsv function. This enhancement addresses three
issues on the bug tracker, all of which are about the function being
non-compliant with RFC 4180[3]. To summarise the issue; the function uses
NL as its EOL character when the RFC stipulates that it should be CRLF. To
maintain backward compatibility the function still defaults to NL, but this
enhancement gives you the ability to provide a different character sequence
instead.

I'm hoping this gains some interest this time, even though it is quite
insignificant.

Kind regards,

Cameron

[1] https://externals.io/message/112248
[2] https://github.com/php/php-src/pull/6403
[3] https://tools.ietf.org/html/rfc4180
ReplyForward


[PHP-DEV] fputcsv is not compliant with the CSV RFC

2020-11-14 Thread Cameron Hall
Hi internals,

I've come across a small nuance recently noticing that the fputcsv function
isn't compliant with the RFC because it uses LF as a line terminator
instead of CRLF as per RFC 4810[1]. There are a few related bug reports
already; #42357[4], #46367[2] and #62770[3].

I've created a pull request[5] to address the issue by adding a new
parameter that allows a user defined line ending as suggested in bug report
#42357[4]. In order to maintain backwards compatibility, fputcsv() still
terminates lines with "\n" by default.

While my pull request is addressing a bug, adding a new parameter is also a
new feature. I'd love to see some opinions from the internals team
regarding the best way forward.

Kind regards,

Cameron

[1] https://tools.ietf.org/html/rfc4180
[2] https://bugs.php.net/bug.php?id=46367
[3] https://bugs.php.net/bug.php?id=62770
[4] https://bugs.php.net/bug.php?id=42357

[5] https://github.com/php/php-src/pull/6403