Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45969 Return-Path: <0xcafefeed@gmail.com> Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2956 invoked from network); 6 Nov 2009 16:00:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2009 16:00:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=0xcafefeed@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=0xcafefeed@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.213 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: 0xcafefeed@gmail.com X-Host-Fingerprint: 209.85.218.213 mail-bw0-f213.google.com Received: from [209.85.218.213] ([209.85.218.213:52585] helo=mail-bw0-f213.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/D6-64566-D0844FA4 for ; Fri, 06 Nov 2009 11:00:14 -0500 Received: by bwz5 with SMTP id 5so1368679bwz.23 for ; Fri, 06 Nov 2009 08:00:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=icCNvuChi3RbAjXM0gQD3/A0e6RqF02BJnA3++NtwYk=; b=uV/lOAnLRkLvDKWZ8dZSXzRnNr+YK78wqoa+SL/F7Il3Jba7kn0gS+LfGo7XAqqNzo Lo4FsDVl5jM3W6EJ4J78SwD66Fey6D65PgfMQDvVEjqP9xxvkB00wpf0NjDr8pW23o0b XfIf0QMPy5I7lfEZQtesTDxQZP6a/Tr0fVXWs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=JkqVlIgKIQuc2c/74ksF6yeBnEnwDscUMnCLprlio8fHmRQkE9rh9rCShBDo6nuOao 1W9zJQb0cLuUP9lv6M4Cn8aaCJwkRLPjEOfky10r2vwmBmPB9n71yAwHKbkzIajnSVTK dC00OYkPskaFt/qccr5REJ+SzP0/eSmSlW2fM= MIME-Version: 1.0 Received: by 10.204.157.16 with SMTP id z16mr4848863bkw.103.1257523207468; Fri, 06 Nov 2009 08:00:07 -0800 (PST) In-Reply-To: <3D00FD9C-488D-4BE0-A17E-48828C24EC60@macvicar.net> References: <3D00FD9C-488D-4BE0-A17E-48828C24EC60@macvicar.net> Date: Fri, 6 Nov 2009 08:00:07 -0800 Message-ID: To: Scott MacVicar Cc: daqing , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] typo found in ext/standard/string.c, inside function nl2br, php 5.3.0 svn trunk From: 0xcafefeed@gmail.com (mm w) say CR LF carriage return and line feed, yes those characters could be trimmed, I think it's a choice to keep the original input you could redefine a function if your are no happy with it or even add an optional param to the C function: bool preserveCRLF, I am not really convinced by Scott argument 8-) On Friday, November 6, 2009, Scott MacVicar wrote: > On 6 Nov 2009, at 03:18, daqing wrote: > > > hi, all: > > I just found a typo today when I read the source code of function nl2br, > here is what 'svn diff' produce against the php 5.3.0 svn trunk: > > Index: ext/standard/string.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- ext/standard/string.c =C2=A0 =C2=A0 =C2=A0 (revision 290364) > +++ ext/standard/string.c =C2=A0 =C2=A0 =C2=A0 (working copy) > @@ -3918,7 +3918,7 @@ > =C2=A0 =C2=A0 =C2=A0 tmp =3D str; > =C2=A0 =C2=A0 =C2=A0 end =3D str + str_len; > > - =C2=A0 =C2=A0 =C2=A0 /* it is really faster to scan twice and allocate = mem once insted > scanning once > + =C2=A0 =C2=A0 =C2=A0 /* it is really faster to scan twice and allocate = mem once instead > scanning once > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0and constantly reallocing */ > =C2=A0 =C2=A0 =C2=A0 while (tmp < end) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (*tmp =3D=3D '\r') { > > > > This typo and the grammatical error are fixed now. > > > > > besides, I have a question: why not function nl2br just replace the "\r\n= ", > "\n", "\r" things with "
"? why insert "
" before those "\r\n", > "\n", "\r"? > > > > Because its much easier to read the output when the newlines are preserve= d. > > Scott > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >