FAQ
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);

Search Discussions

  • David Soria Parra at Nov 22, 2006 at 1:40 am
    anyone who has karma can check that patch? Would be nice.
  • Pierre at Nov 22, 2006 at 1:01 pm

    On 11/22/06, David Soria Parra wrote:
    anyone who has karma can check that patch? Would be nice.
    Done, I also updated your test.

    --Pierre

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedNov 19, '06 at 3:52p
activeNov 22, '06 at 1:01p
posts3
users2
websitephp.net

2 users in discussion

David Soria Parra: 2 posts Pierre: 1 post

People

Translate

site design / logo © 2022 Grokbase