#43225 [Opn->Fbk]: fputcsv incorrectly handles cells ending in \ followed by "

From: Date: Mon, 14 Jul 2008 21:26:42 +0000
Subject: #43225 [Opn->Fbk]: fputcsv incorrectly handles cells ending in \ followed by "
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126709@lists.php.net to get a copy of this message
ID: 43225 Updated by: jani@php.net Reported By: ed at bronto dot com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Centos PHP Version: 5.2.4 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi Previous Comments: ------------------------------------------------------------------------ [2008-04-17 01:00:55] dan at expireddomain dot com Same problem on windows XP PHP version 5.2.5 on cells that contain a \ followed by double quotes (") ------------------------------------------------------------------------ [2007-11-09 14:59:11] ed at bronto dot com Description: ------------ Using fputcsv to output a cell that ends with a \ followed by double quotes (") causes it to not use any escape sequence. Oddly, fgetscsv is able to parse it correctly. Unlike fgetscsv, I assume fputcsv follows RFC 4180 and uses " as the escape character. Reproduce code: --------------- $row = array(); $row[] = 'a\\"'; $row[] = 'bbb'; $fp = fopen('test.csv', 'w+'); fputcsv($fp, $row); fclose($fp); Expected result: ---------------- expected output: "a\""",bbb Actual result: -------------- actual output: "a\"",bbb ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43225&edit=1

« previous php.bugs (#126709) next »