Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41325 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58539 invoked from network); 22 Oct 2008 20:26:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2008 20:26:35 -0000 Authentication-Results: pb1.pair.com header.from=jmertic@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=jmertic@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 66.249.92.171 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: jmertic@gmail.com X-Host-Fingerprint: 66.249.92.171 ug-out-1314.google.com Received: from [66.249.92.171] ([66.249.92.171:38779] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/59-41302-97C8FF84 for ; Wed, 22 Oct 2008 16:26:35 -0400 Received: by ug-out-1314.google.com with SMTP id k3so1484984ugf.37 for ; Wed, 22 Oct 2008 13:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=yE/p0VXK//T2XkwNJl8RJDowhG0Spx3KHnwptO9C8WA=; b=ugvAlTjH+TUu6f8mEOEHye0cA3k8oX1ZrtlU4JIkDqBL0Umhmd4/T8IN09qHMmW2UY 62VFfsjm29uYlyliOpTFxfBJlb+nReMhyLlkB7CBIJxlgRrws1VPjCfkT9zSbLJ4BTTc wbp3vqqpR3IdihseKVTw66wyiQ2H1Lr6QnSX8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=muaE04ToGLRHIYgJB3GjBjPJvqVxKb1zwmWao6GyfLiBG2zFmzAgPs0Xorj7V7BCK5 cVBmA8WkEYbSnPy0zt95+h7BRsGhBRsNm1qc8t6VVIQbANUy1fZiFYrKDM4Hc/WUwxsx CcMivlueoovirVHttapyIC3AqyaJ5AxN14C2c= Received: by 10.210.81.10 with SMTP id e10mr12425109ebb.122.1224707190593; Wed, 22 Oct 2008 13:26:30 -0700 (PDT) Received: by 10.210.125.16 with HTTP; Wed, 22 Oct 2008 13:26:30 -0700 (PDT) Message-ID: <2a9adcf0810221326u798498bbgb4ab37f7c27f21ef@mail.gmail.com> Date: Wed, 22 Oct 2008 16:26:30 -0400 Sender: jmertic@gmail.com To: "Ilia Alshanetsky" Cc: "Lars Strojny" , internals@lists.php.net In-Reply-To: <370571A4-8A89-412C-A8CD-1D7439C761F1@prohost.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <2a9adcf0810221003i70f37558ob5777b5603865cdf@mail.gmail.com> <1224696974.17075.1.camel@localhost> <2a9adcf0810221135h1e6ed4ecub55318cfb26b3e7e@mail.gmail.com> <370571A4-8A89-412C-A8CD-1D7439C761F1@prohost.org> X-Google-Sender-Auth: 5585a7f5fefc6eca Subject: Re: [PHP-DEV] [PATCH] Bug #46367 - fputcsv does not add the correct newline character on Windows From: jmertic@php.net ("John Mertic") Hi Ilia, Sorry for my C confusion, like I said it's been awhile. Anyways, would smart_str_appends() be the correct function to use then? 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 4:16 PM, Ilia Alshanetsky wrote: > You cannot use smart_str_appendc() in this case, since the EOL could be a 2 > byte string "\r\n". > > smart_str_appendl(&csvline, PHP_EOL, sizeof(PHP_EOL)-1); should be used > here. > > On 22-Oct-08, at 2:35 PM, John Mertic wrote: > >> 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 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 >>> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php > > Ilia Alshanetsky > > > > >