Re: [PATCH] Bug #46367 - fputcsv does not add the correct newline character on Windows
| From: | John Mertic | Date: | Wed, 22 Oct 2008 18:35:49 +0000 |
| Subject: | Re: [PATCH] Bug #46367 - fputcsv does not add the correct newline character on Windows | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41323@lists.php.net to get a copy of this message | ||
Hi Lars,
Thanks for the pointers, updated the patch and added a test.
Index: file.c
===================================================================
RCS file: /repository/php-src/ext/standard/file.c,v
retrieving revision 1.530
diff -u -r1.530 file.c
--- file.c 21 Oct 2008 22:06:48 -0000 1.530
+++ file.c 22 Oct 2008 18:21:10 -0000
@@ -2104,7 +2104,7 @@
}
}
- smart_str_appendc(&csvline, '\n');
+ smart_str_appendc(&csvline, PHP_EOL);
smart_str_0(&csvline);
ret = php_stream_write(stream, csvline.c, csvline.len);
John Mertic
jmertic@gmail.com
http://jmertic.wordpress.com
"Explaining a joke is like dissecting a frog: you understand it
better, but the frog dies
in the process." --Mark Twain
On Wed, Oct 22, 2008 at 10:36 AM, Lars Strojny <lstrojny@php.net> wrote:
> Hi John,
>
>
> Am Mittwoch, den 22.10.2008, 10:03 -0700 schrieb John Mertic:
> [...]
>> Below is a patch to fix this issue; it uses the constant PHP_EOL to
>> get the correct newline to use on the current platform:
>
> Thanks for your patch. A few things to mention, as it is your first
> patch: please use "diff -ru" to create unified diffs. Also we try to
> always add tests for the things we fix or create. Would you mind
> creating a test for the fix you sent to make sure no regression happens
> in the next n years?
>
> Thanks, Lars
> --
> Jabber: lars@strojny.net
> Weblog: http://usrportage.de
>