ID: 41668 Updated by: [EMAIL PROTECTED] Reported By: jkapicak at chip dot de -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: Debian / Ubuntu PHP Version: 5.2.3 New Comment:
"If a field's value contains a double quote character it is escaped by placing another double quote character next to it." Previous Comments: ------------------------------------------------------------------------ [2007-06-12 10:03:23] jkapicak at chip dot de 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 this bug report at http://bugs.php.net/?id=41668&edit=1