|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-10-24 17:32 UTC] cmb@php.net
[2018-02-15 13:22 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2018-02-15 13:22 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 27 12:00:01 2025 UTC |
Description: ------------ Since 5.4.4 there's an `escape_char` parameter that's defaulting to \. It looks like that parameter is meaningless though as of all the possible values passed in, only " really does something and what it does is break the CSV encoding. Test script: --------------- <?php $fh = fopen('php://stdout', 'w'); fputcsv($fh, ['using default', 'a,"b'], ',', '"'); fputcsv($fh, ['using " ', 'a,"b'], ',', '"', '"'); fputcsv($fh, ['using x ', 'a,"b'], ',', '"', 'x'); fputcsv($fh, ['using \\ ', 'a,"b'], ',', '"', '\\'); Expected result: ---------------- "using default","a,\"b" "using " ","a,""b" "using x ","a,x"b" "using \ ","a,\"b" Actual result: -------------- "using default","a,""b" "using " ","a,"b" "using x ","a,""b" "using \ ","a,""b"