Bug #66126 [Opn->Nab]: SplFileObject READ_CSV ignores multi line csv data
Edit report at https://bugs.php.net/bug.php?id=66126&edit=1
ID: 66126
Updated by: cmb@php.net
Reported by: m dot gribben at yellowsatsuma dot com
Summary: SplFileObject READ_CSV ignores multi line csv data
-Status: Open
+Status: Not a bug
Type: Bug
Package: SPL related
Operating System: Ubuntu
PHP Version: 5.4.22
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
See <https://gist.github.com/anonymous/7561146#file-gistfile1-php-L18-L19>,
where the second call to SplFileObject::setFlags() overrides the
the first.
Previous Comments:
------------------------------------------------------------------------
[2013-11-20 10:48:43] m dot gribben at yellowsatsuma dot com
Description:
------------
When running SplFileObject with the READ_CSV flag set, it does not obey the field enclosure setting
(") and thus ignores any multi lined data in the CSV file, IE any data field with new lines in
it.
Test script:
---------------
https://gist.github.com/anonymous/7561146
Expected result:
----------------
I would expect the code to read the file as a CSV and when a field is enclosed in the correct markup
that its contents be treated as a single line of CSV regardless of it having new lines in it.
Actual result:
--------------
The code correctly reads most lines but when a field contains a new line it treats that as the end
of that line of CSV, even when enclosed in double quotes.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66126&edit=1
Thread (2 messages)