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)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 48 - 32 = ?

 
 [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.

Comments

 [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 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.