Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9661 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7260 invoked by uid 1010); 4 May 2004 16:14:21 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 7218 invoked from network); 4 May 2004 16:14:20 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 4 May 2004 16:14:20 -0000 Received: from TRILLIAN (unknown [83.97.8.186]) by shiva.mind.de (Postfix) with ESMTP id 641D697B58; Tue, 4 May 2004 18:13:35 +0200 (CEST) Date: Tue, 4 May 2004 18:12:19 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1243731871.20040504181219@marcus-boerger.de> To: Aaron Wormus Cc: internals@lists.php.net In-Reply-To: <40975865.6000706@wormus.com> References: <40975865.6000706@wormus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] PHP -R STDIN chomping line ends From: helly@php.net (Marcus Boerger) Hello Aaron, the idea of removing the line ends comes from copying other unix tools behavior. Also reappending a line ending should result in the standard line ending for the platform used. So th eproblem is actually working with input from another platform. I won't change the standard behavior of the -R/-F switch but could probably add it a new switch which would stop removing the trailing new lines. marcus Tuesday, May 4, 2004, 10:46:29 AM, you wrote: > Greetings! > I've been exploring the work done on the PHP CLI sapi, and am impressed > with the new features that are in PHP 5. > One thing that I am a bit troubled about is the behaviour of the -R > switch in that it removes the trailing \n and \r line end characters > when it delivers the line to $argn. I can't see any useful reasons for > it doing this, and it does not handle STDIN the way it should. > The following file should just pass through the following code, not > strip out all the line ends: > cat file.txt | php -R 'echo "$argn";' > I realize that one possible reason that this was included was because > it is simpler to add a line end if needed then to chomp it. However, > even if I do use: > cat file.txt | php -R 'echo "$argn\n";' > if the file uses \r\n line ends, it still changes the file. And it's > unacceptable to have to know what type of file it is when doing a > command as simple as that. > Curt Zirzow provided me with the patch that I'm including, and would > like to ask that the behaviour be changed before the PHP 5 final. > I realize that this has been working like this for over a year, and by > making this change we would be breaking backwards compatibility (with > pre version 5 releases). However, since I do believe that this behaviour > is wrong, I feel that it would be a mistake to let it get into the PHP 5 > final, as it will need to get changed sooner or later, and if it is > introduced into PHP with version 5 then it will be much harder to reverse. > I'm sorry if I'm ranting a bit. I am known to miss obvious things, so > if it's my mistake and there is a good reason for the behaviour, please > let me know. I appreciate all the work that has gone into PHP 5, I'm > enjoying it throughly! > Aaron -- Best regards, Marcus mailto:helly@php.net