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 ([EMAIL PROTECTED])

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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to