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

Bug #18049 discoverFormat bug, Find all seps that are within qoutes
Submitted: 2010-11-12 20:38 UTC
From: bart_pea Assigned: dufuz
Status: Closed Package: File_CSV (version 1.0.0alpha1)
PHP Version: 5.3.0 OS: linux
Roadmaps: (Not assigned)    

 [2010-11-12 20:38 UTC] bart_pea (Bart Pronk)
Description: ------------ Within the function discoverFormat($file, $extraSeps = array() every line is adjusted with: $line = preg_replace("|^[^$quotes$sep]*$sep*([$quotes][^$quotes]*[$quotes])|sm", '_', $orgLine); to avoid seperators within quotes being counted. I am no regex guru but I think there is a asmall error in the code. This will replace this whole line: 1001;"Dorpstraat 160" into underscore And because of that no seperators are found. Suggested fix: $line = preg_replace("|^[$quotes$sep]*$sep*([$quotes][^$quotes]*[$quotes])|sm", '_', $orgLine); Test script: --------------- 1001;"Dorpstraat 160" 1002;"Access Wiseguy (vakantie informatie punt)" 1004;"Gehandicapten sticht. Arnhem" 1090;"HWL algemeen" Expected result: ---------------- I expect 2 columns for each line because the semicolon is the seperator. Actual result: -------------- Whole line is one colomn, no seperators found.


 [2011-03-11 02:27 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Status: Open +Status: Closed -Assigned To: +Assigned To: dufuz
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the 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.