Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41320 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62688 invoked from network); 22 Oct 2008 17:03:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2008 17:03:50 -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.169 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.169 ug-out-1314.google.com Received: from [66.249.92.169] ([66.249.92.169:7372] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/A3-41302-5FC5FF84 for ; Wed, 22 Oct 2008 13:03:50 -0400 Received: by ug-out-1314.google.com with SMTP id k3so1425615ugf.37 for ; Wed, 22 Oct 2008 10:03:46 -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:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=1M58/j3sD1B2PoqlKc72/PVfKzXYLb5bIpau+w509fU=; b=oxqiBPTl8B+loQhxA5a5czB+vi7Ptv6f49bUBySXssclPBOgx5SBDnfAzEyGxcxUIK 9DTQMctI708IWIZQhlWIinOH6G+losGMVBerlBjMNGS6uDlMOufsqLeKOzZQ1jQZwJZm iJC5h7Ck8i43sYegd4MRg/2fT/bHpbVqpBPhI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=br8hUfn5yo1TCCsF90pTn4kHw7c63N1IH/Jk8RAMVdRSM1XD2uhz4uyI+tBJU0vu6A YX2E5xDoF9AQ8pQ9J82MyfMe//SjA/iayRTZSBxnjDZkh8a74johC6JFp/QyAruaQdrS FM8ntrYJJy9Zx5vrHcBMevGzmx5PrxeRqW/pk= Received: by 10.210.37.11 with SMTP id k11mr3592114ebk.153.1224695026235; Wed, 22 Oct 2008 10:03:46 -0700 (PDT) Received: by 10.210.125.16 with HTTP; Wed, 22 Oct 2008 10:03:46 -0700 (PDT) Message-ID: <2a9adcf0810221003i70f37558ob5777b5603865cdf@mail.gmail.com> Date: Wed, 22 Oct 2008 10:03:46 -0700 Sender: jmertic@gmail.com To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: def725ec442b9342 Subject: [PATCH] Bug #46367 - fputcsv does not add the correct newline character on Windows From: jmertic@php.net ("John Mertic") Hi All, My first patch so be gentle :-). Per the documentation for the fputcsv() function, it adds a newline to the end of the csv string it returns. However, it is hardcoded to be '\n' ( default for unix newline ), while Windows uses \r\n. PHP should do this as well. 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: Index: php-src/ext/standard/file.c =================================================================== RCS file: /repository/php-src/ext/standard/file.c,v retrieving revision 1.530 diff -r1.530 file.c 2107c2107 < smart_str_appendc(&csvline, '\n'); --- > smart_str_appendc(&csvline, PHP_EOL); 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