CSV documentation functions need a clearer warning about the proprietary escape mechanism.
A lot of people, myself included, expected the 3 CSV-functions:
- fputcsv()
- fgetcsv()
- str_getcsv()
to work in the most consistent/standard/obvious way when called without the optional parameters. But it doesn't! The default is backwards - if you want to be RFC-4180 compliant, you need to explicitly set the 5th option to be the empty string. This is unusual for PHP: normally optional parameters can be omitted unless you want to do something unusual. This has bitten people repeatedly, even leading to an RFC: https://wiki.php.net/rfc/kill-csv-escaping
So, my suggestion is that each of these 3 has a clearly worded "Note" added, namely:
The default-value of the proprietary-escape mechanism is "", which is inconsistent with the most common standard for CSV files, RFC-4180. For compatibility, it is recommended that you always explicitly specify the 5th parameter, 'escape', as "", i.e. the empty string.
Thanks.
Could you provide a PR?
Also the RFC has only been enacted with step 1 none of the other steps have been taken.