php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30097 fgetcsv() does not recognize Mac EOL character (\r) as the EOL marker
Submitted: 2004-09-15 19:17 UTC Modified: 2004-09-26 04:21 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: dbeckham at dealnews dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.1 OS: Mac OS X 10.3.5
Private report: No CVE-ID: None
 [2004-09-15 19:17 UTC] dbeckham at dealnews dot com
Description:
------------
fgetcsv() does not recognize the Macintosh EOL character (\r) as a legitimate EOL marker for a CSV file.

Reproduce code:
---------------
Read any CSV file that uses Mac EOL markers using fgetcsv().

Expected result:
----------------
fgetcsv() should recognized Mac EOL (\r) markers as the end of a CSV record.

Actual result:
--------------
The entire file is read as if it's a single CSV record.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-23 21:42 UTC] iliaa@php.net
Did you try enable automatic EOL detection.
 [2004-09-24 14:28 UTC] dbeckham at dealnews dot com
Using "php -d auto_detect_line_endings=1" worked and I was able to successfully read a csv file with \r line endings.

That said, wouldn't this config option be better named if it was called "also_support_mac_line_endings"?  The config option isn't needed for Unix or PC line endings, as PHP already works out of the box (so to speak) with them.

There are only three main types of line endings, Unix, PC and Mac.  Why are the Mac line endings singled out like this?  Why do they need a special config option to be set, just to recognize them?  It's not as if PHP only recognizes the line endings of the platform it's compiled on.
 [2004-09-24 14:36 UTC] dbeckham at dealnews dot com
I'm changing this bug to a documentation problem.  The fgetcsv() docs should also have the same information that fgets() and file() have about the auto_detect_line_endings configuration option.
 [2004-09-26 04:21 UTC] aidan@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 21:01:26 2024 UTC