#21556 [Opn->Fbk]: fgetcsv hangs if the csv file contains a "

From: Date: Thu, 09 Jan 2003 23:10:42 +0000
Subject: #21556 [Opn->Fbk]: fgetcsv hangs if the csv file contains a "
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29624@lists.php.net to get a copy of this message
ID: 21556 Updated by: iliaa@php.net Reported By: caseymanus@msn.com -Status: Open +Status: Feedback Bug Type: Scripting Engine problem PHP Version: 4.3.0 New Comment: I've just commited a patch to the CVS that may resolve the problem, please wait a few hours and then grab a snapshot from http://snaps.php.net/. Previous Comments: ------------------------------------------------------------------------ [2003-01-09 16:32:39] caseymanus@msn.com Yeah, Just copy this text to a file and then save it as test.csv just a bunch of data, jere, fadjsfd, aksjfllsd, adfjsdkl fajsdlfls, afdlsfkjfdsal, adjfsljfas, adfjsldkfjs, dkslafj fjadskjf, aksdjfls, afksfdjl""", jlkjl, jlkjkl, jlkjl, jlak fajlsd, jfadlsl, ajfldsja, akfjsdl, ajsdflj, ajdskfks as you will see it hangs on the third line ------------------------------------------------------------------------ [2003-01-09 16:24:37] iliaa@php.net Could you please provide a sample csv file that could be used to replicate the problem. ------------------------------------------------------------------------ [2003-01-09 16:01:36] caseymanus@msn.com Usings the basic fgetcsv example, <?php $row = 1; $fp = fopen ("test.csv","r"); while ($data = fgetcsv ($fp, 1000, ",")) { $num = count ($data); print "<p> $num fields in line $row: <br>\n"; $row++; for ($c=0; $c < $num; $c++) { print $data[$c] . "<br>\n"; } } fclose ($fp); ?> If the CSV contains a double quote, fgetcsv hangs on that line and memory utilization spikes. I have reproduced this. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21556&edit=1

« previous php.bugs (#29624) next »