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

Bug #14118 Error with quoted fields and separators
Submitted: 2008-06-10 16:02 UTC Modified: 2008-10-26 16:40 UTC
From: dpm64 Assigned: dufuz
Status: Closed Package: File_CSV
PHP Version: 5.2.4 OS: Linux
Roadmaps: 1.0.0    
Subscription  


 [2008-06-10 16:02 UTC] dpm64 (David Megginson)
Description: ------------ With the following sample data, the parser misparses a separator inside a quoted field when the record ends with a separator (line 1), but not when the record ends with an empty quoted field (line 2): "ENFB","closed","Oslo, Fornebu","Airport", "ENFG","medium_airport","Leirin, Leirin","Airport","" Test script: --------------- <?php require_once("File/CSV.php"); $file = 'sample.csv'; $config = File_CSV::discoverFormat($file); while ($row = File_CSV::read($file, $config)) { print_r($row); } ?> Expected result: ---------------- Array ( [0] => ENFB [1] => closed [2] => Oslo, Fornebu [3] => Airport ) Array ( [0] => ENFG [1] => medium_airport [2] => Leirin, Leirin [3] => Airport ) Actual result: -------------- Array ( [0] => ENFB [1] => closed [2] => "Oslo [3] => Fornebu" [4] => Airport ) Array ( [0] => ENFG [1] => medium_airport [2] => Leirin, Leirin [3] => Airport [4] => )

Comments

 [2008-10-26 07:10 UTC] doconnor (Daniel O'Connor)
The unit test for this bug is currently broken.
 [2008-10-26 07:12 UTC] doconnor (Daniel O'Connor)
(Parse error: syntax error, unexpected T_VARIABLE in /home/clockwerx/pear/File/tests/CSV/bug14118-1.php on line 6)
 [2008-10-26 16:40 UTC] dufuz (Helgi Þormar Þorbjörnsson)
This bug has been fixed in CVS. 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.