Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26667 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39882 invoked by uid 1010); 19 Nov 2006 15:52:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 39867 invoked from network); 19 Nov 2006 15:52:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2006 15:52:25 -0000 X-Host-Fingerprint: 84.150.93.24 p54965D18.dip.t-dialin.net Received: from [84.150.93.24] ([84.150.93.24:4094] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/21-29171-6BD70654 for ; Sun, 19 Nov 2006 10:52:23 -0500 To: internals@lists.php.net Date: Sun, 19 Nov 2006 16:52:20 +0100 User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) Message-ID: Reply-To: dsp@php.net MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-Posted-By: 84.150.93.24 Subject: [PATCH] For Bug #39538 From: dsp@php.net (David Soria Parra) Hi Internals, I tried to fix the newline bug #39538 (http://bugs.php.net/bug.php?id=39538) that appears using fgetcsv with unix newlines LF, instead of the csv rfc CRLF. I didn't fix the backslash escape stuff, as this might be expected behviour. Greets David (dsp@php.net) The patch against 5_2_0 Index: file.c =================================================================== RCS file: /repository/php-src/ext/standard/file.c,v retrieving revision 1.409.2.6.2.10 diff -u -r1.409.2.6.2.10 file.c --- file.c 15 Nov 2006 00:20:40 -0000 1.409.2.6.2.10 +++ file.c 18 Nov 2006 13:43:48 -0000 @@ -2171,9 +2171,11 @@ size_t new_len; char *new_temp; - memcpy(tptr, hunk_begin, bptr - hunk_begin); - tptr += (bptr - hunk_begin); - hunk_begin = bptr; + if (hunk_begin != line_end) { + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + hunk_begin = bptr; + } /* add the embedded line end to the field */ memcpy(tptr, line_end, line_end_len);