From:             jkapicak at chip dot de
Operating system: Debian / Ubuntu
PHP version:      5.2.3
PHP Bug Type:     Filesystem function related
Bug description:  wrong parse of double quote when it is together with 
enclosure, e.g.: ""|"

Description:
------------
If the double quote is close to enclosure, fgetcsv parses the line wrong.
This is parsed wrong: "200"|"15,4""|"aa"
When escaped, it would work: "200"|"15,4\""|"aa"

Jozef

Reproduce code:
---------------
test.csv:

"200"|"15,4""|"aa"
"200"|"15,4 "|"aa"

text.php:

<?php

$aOut = array();
$handle = fopen("test.csv", "r");
while (($data = fgetcsv($handle, 100, '|', '"')) !== FALSE) {
    print_r($data);
}
fclose($handle);

?> 

Expected result:
----------------
Array
(
    [0] => 200
    [1] => 15,4"
    [2] => aa
)
Array
(
    [0] => 200
    [1] => 15,4
    [2] => aa
)


Actual result:
--------------
Array
(
    [0] => 200
    [1] => 15,4"|aa"
)
Array
(
    [0] => 200
    [1] => 15,4
    [2] => aa
)


-- 
Edit bug report at http://bugs.php.net/?id=41668&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41668&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41668&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41668&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41668&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41668&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41668&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41668&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41668&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41668&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41668&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41668&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41668&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41668&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41668&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41668&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41668&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41668&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41668&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41668&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41668&r=mysqlcfg

Reply via email to