PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File System » File » Bug #4334

File_CSV::discoverFormat does not detect quotes in single column

Details

Submitted2005-05-12 15:22 UTC
Fromluke_richards_99 at yahoo dot co dot uk
Assigneddufuz
StatusClosed
PackageFile
PHP Version4.3.9
OSLinux
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
)