|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-09-27 08:56 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2018-09-27 08:56 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 00:00:01 2025 UTC |
Description: ------------ When a value passed to `fputcsv` ends with the escape character, `fgetcsv` (and `str_getcsv`) do not correctly parse it. I'm not sure if this is an issue with `fputcsv` not escaping the escape character or `fgetcsv` not handling things properly. Test script: --------------- <?php $input = array(1, 3, '3\\', 5, 3); $f = fopen('php://temp,', 'w+'); fputcsv($f, $input); rewind($f); $output = stream_get_contents($f); rewind($f); var_dump($input, $output, str_getcsv($output), fgetcsv($f)); fclose($f); Expected result: ---------------- I expect `$input` and the results from `str_getcsv` and `fgetcsv` to be the same Actual result: -------------- The final three fields, including separators, are parsed as a single field.