Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

auto_detect_line_endings - Are there side effects?

Tags:

php

csv

I'm writing a script that processes CSV's and I've discovered that setting auto_detect_line_endings seems to be the way to go to handle CSV's created on Macs.
Are there any possible downsides or side-effects to making this setting change? I couldn't seem to spot any (which begs the question, why wouldn't you always have it on?)

ini_set('auto_detect_line_endings', true);

like image 241
paullb Avatar asked Jul 10 '15 01:07

paullb


1 Answers

Only for CSV files created on ancient Macs that have \r line endings. It's not a default because such files are rare and there's a tiny performance penalty. It's safe to turn it on if you want to be as permissive as possible about the CSV files you want to process.

like image 148
pvg Avatar answered Nov 14 '22 22:11

pvg