From:             andrew at shh dot fi
Operating system: win32
PHP version:      5.0.0RC2
PHP Bug Type:     Filesystem function related
Bug description:  fgetcsv gives error with delim and enclosure set as variable

Description:
------------
Pass a variable to the delimiter and enclosure of the fgetcsv returns the
error:

Warning: fgetcsv() [function.fgetcsv]: enclosure must be a character in
....

It seems that it will only accept it hard coded:
fgetcsv($handle, 2000, ",", '')
All a bit wierd!

Used the latest CVS

Works in 4.3.7


Reproduce code:
---------------
function csv_import($file, $delimiter = ",", $enclosure='') {
$handle = fopen($file, "r");
        $csv_arr = array();
         while (($data_arr = fgetcsv($handle, 2000, $delimiter, $enclosure)) !==
FALSE) {
                $csv_arr[] = $data_arr;
                $row++;
         }
         fclose($handle);
 }

Expected result:
----------------
No error


-- 
Edit bug report at http://bugs.php.net/?id=28347&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28347&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28347&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28347&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28347&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28347&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28347&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28347&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28347&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28347&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28347&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28347&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28347&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28347&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28347&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28347&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28347&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28347&r=float

Reply via email to