Home » File System » File » Bug #4334
File_CSV::discoverFormat does not detect quotes in single column
Details
| Submitted | 2005-05-12 15:22 UTC |
|---|---|
| From | luke_richards_99 at yahoo dot co dot uk |
| Assigned | dufuz |
| Status | Closed |
| Package | File |
| PHP Version | 4.3.9 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-05-12 15:22 UTC] luke_richards_99 at yahoo dot co dot uk
Description:
------------
Using versions:
PEAR ver 1.3.5
File ver 1.2.0 (cvs 1.29)
File_CSV (cvs 1.19)
When using a file with a single column format, the discoverFormat method doesn't detect the quotes.
I believe the problem lies with line 473:
preg_match("|^([$quotes]).*([$quotes])$sep
should be
preg_match("|^([$quotes]).*([$quotes])$sep{0,1}
Reproduce code:
---------------
Save a File
<<<
"Sample Data Line 1"
"Sample Data Line 2"
"Sample Data Line 3"
"Sample Data Line 4"
"Sample Data Line 5"
>>>
$config = File_CSV::discoverFormat("/path/to/file.txt");
Expected result:
----------------
Array
(
[fields] => 1
[sep] => ,
[quote] => "
)
Actual result:
--------------
Array
(
[fields] => 1
[sep] => ,
[quote] => null
)