From: [EMAIL PROTECTED] Operating system: Linux PHP version: 4.0.6 PHP Bug Type: Filesystem function related Bug description: fgetcsv does some wrong things <? /* - fgetcsv when used with non " delimiter causes problems - script called from command line - on a large file (25,000 lines) the script will core dump most times with a segmentation fault Contents of gr DOS (CR/LF) or Unix (LF) record termination makes no difference to result ------------------------------------------ 26261~~5402211~yes~MASTERFULL~0 26263~~0126003045~yes~"PIONEERING"~0 26263~~039300358~yes~ " CASSIOPEIA~0 26263~~91054745~yes~OLYMPIC~0 26261~~2302~yes~MASTERLESS~0 26263~~6003045~yes~PIONEERING~0 ------------------------------------------ */ $file_name = "/tmp/unix/gr"; // Faulty: echo "\nFAULTY\n"; $text_file = fopen($file_name,"r"); if ($text_file) { $count=1; while ($data=fgetcsv($text_file,200,"~")) { echo "Record:$count:".$data[0].":".$data[2].":".$data[4]."\n"; $count++; } echo "$file_name Complete\n"; } fclose($text_file); /* Problem 1: This will stop in the third record because of the unmatched " Problem 2: It strips the " characters out of the resultant array fields */ //Working: echo "\nWORKING\n"; $text_file = fopen($file_name,"r"); if ($text_file) { $count=1; while ($data_in=fgets($text_file,200)) { $data=explode("~",$data_in); echo "Record:$count:".$data[0].":".$data[2].":".$data[4]."\n"; $count++; } echo "$file_name Complete\n"; } fclose($text_file); /* SCRIPT OUTPUT FAULTY Record:1:26261:5402211:MASTERFULL Record:2:26263:0126003045:PIONEERING /tmp/unix/gr Complete WORKING Record:1:26261:5402211:MASTERFULL Record:2:26263:0126003045:"PIONEERING" Record:3:26263:039300358: " CASSIOPEIA Record:4:26263:91054745:OLYMPIC Record:5:26261:2302:MASTERLESS Record:6:26263:6003045:PIONEERING /tmp/unix/gr Complete */ -- Edit bug report at: http://bugs.php.net/?id=12643&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]