Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0

Bug #18111 discoverFormat: Quote not detected in short lines
Submitted: 2010-12-10 18:17 UTC
From: henkiepenkie Assigned: dufuz
Status: Closed Package: File_CSV (version 1.0.0alpha1)
PHP Version: 5.3.4 OS: Windows
Roadmaps: (Not assigned)    
Subscription  


 [2010-12-10 18:17 UTC] henkiepenkie (Henk Penk)
Description: ------------ The quote is not recognized if the csv looks like 123456789;"1 test" 287654321;"3 too" 323456789;"3 test" 487654321;"4 too" Test script: --------------- function getConfig(){ ob_implicit_flush(true); $this->conf = File_CSV::discoverFormat($this->file); return $this->conf; } Expected result: ---------------- array( fields=2 quote=" sep=; ); Actual result: -------------- array( fields=2 quote= sep=; );

Comments

 [2010-12-10 18:22 UTC] henkiepenkie (Henk Penk)
Fixed in discoverFormat: foreach (array('"', '\'') as $q) { /* Old if (preg_match_all("|$sep(?:\s*?)(\=?[$q]).*([$q])$sep|Us", $string, $match)) { */ // Fix. The ? after $sep if (preg_match_all("|$sep(?:\s*?)(\=?[$q]).*([$q])$sep?|Us", $string, $match)) { if ($match[1][0] == $match[2][0]) { $quote = $match[1][0]; break; } } if ( preg_match_all("|^(\=?[$q]).*([$q])$sep{0,1}|Ums", $string, $match) || preg_match_all("|(\=?[$q]).*([$q])$sep\s$|Ums", $string, $match) ) { if ($match[1][0] == $match[2][0]) { $quote = $match[1][0]; break; } } }
 [2011-03-11 01:18 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Summary: Quote +Summary: discoverFormat: Quote not detected in short lines -Assigned To: +Assigned To: dufuz
 [2011-03-11 02:27 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.