Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54586 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92803 invoked from network); 14 Aug 2011 15:01:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2011 15:01:27 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vw0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:62982] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2B/20-25134-E33E74E4 for ; Sun, 14 Aug 2011 11:01:24 -0400 Received: by vwl1 with SMTP id 1so3910953vwl.29 for ; Sun, 14 Aug 2011 08:01:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=MrRvpXuFeH7d+MPb/dIp5MsJv3i1cndeDfg3KpDXUpU=; b=Ta7vaqHOBhHtxGi3w3AZUiRHaugefJnsk6N5HtVAVquUKSg+kAn7PVZA9i4QuJpd6C EM87qJDMFhmz0CtCHb7WfNTp7fcCoSh6c6+4J+77WHZwd9J4HvAkeh1cx2ZCOUfSMztY LOus3nuqvXFgXuNylrZu9Omx7tHKwj+a/WCkw= MIME-Version: 1.0 Received: by 10.52.182.6 with SMTP id ea6mr2905926vdc.222.1313334070773; Sun, 14 Aug 2011 08:01:10 -0700 (PDT) Sender: laruence@gmail.com Received: by 10.220.184.76 with HTTP; Sun, 14 Aug 2011 08:01:10 -0700 (PDT) In-Reply-To: References: Date: Sun, 14 Aug 2011 23:01:10 +0800 X-Google-Sender-Auth: nrhU9b7Q4AjYnwdXF0Ru_tLjmu8 Message-ID: To: Derick Rethans Cc: Ferenc Kovacs , PHP Internals , Pierre Joye , Felipe Pena Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE]strn(case)cmp supporting a negative length as its third paramter From: laruence@php.net (Laruence) Hi: sorry, the example is wrong , it should be : thanks 2011/8/14 Laruence : > Hi all internalers: > =C2=A0 =C2=A0Since there comes some new objections, =C2=A0I think I shoul= d open the > RFC voteing again. > > =C2=A0 =C2=A0to Derick, =C2=A0if I extended voting phase for two weeks , = =C2=A0can we > consider =C2=A0this voteing valid? > > =C2=A0 =C2=A0I think this proposal is not explained clearly before, so I = am > going to explain it agian, > > =C2=A0 =C2=A0and I am not good at english, =C2=A0so if I make you confuse= d, sorry in advance. > > =C2=A0 =C2=A0------- > > =C2=A0 =C2=A0this RFC comes from a Featurn request: https://bugs.php.net/= bug.php?id=3D36944 > > =C2=A0 =C2=A0when I saw the request, =C2=A0I totally agree with the repor= ter, =C2=A0and I > think this feature can make sense for simplify following situation: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (strncmp(substr("num_suffix", 0, -5= ), "suffix", 5) =3D=3D 0) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0echo "they have th= e same suffix"; > =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 and you may wondering does negative length make sense? > > =C2=A0 =C2=A0 yes, =C2=A0because substr supports it already: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 echo substr("test", 0, -1); > > =C2=A0 =C2=A0 Now this RFC is =C2=A0calling for vote again, plz read the = RFC, and > vote for it: https://wiki.php.net/rfc/strncmpnegativelen > > =C2=A0 =C2=A0 if you have any question about this, =C2=A0plz write back. > > thanks. > > 2011/8/14 Laruence : >> Hi: >> =C2=A0I think what I was done is try to describe a image, that we can ma= ke >> follow codes more simple: >> >> =C2=A0if (strncmp(substr("num_suffix", 0, -5), "suffix", 5) =3D=3D 0) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0echo "they have the same suffix"; >> =C2=A0} >> >> =C2=A0yes, =C2=A0there is must something not good in my patch, =C2=A0but= I think I >> can tweak it as you wish. >> >> =C2=A0the only thing I want you to accept is : " should this behavior is >> more make sense for some occassion?" >> >> thanks >> >> 2011/8/14 Laruence : >>> Hi: >>> =C2=A0 this just to say that stncasecmp has the same behavior of either >>> negative or postive length argument. >>> >>> =C2=A0 why you insist to this point? =C2=A0as strncmp("aaaa", "bbb", = =C2=A01000000) >>> works with no warning, =C2=A0why negative length need trigger warnings? >>> >>> thanks >>> >>> 2011/8/14 Derick Rethans : >>>> On Sun, 14 Aug 2011, Ferenc Kovacs wrote: >>>> >>>>> On Sun, Aug 14, 2011 at 1:24 PM, Derick Rethans wrot= e: >>>>> > On Sat, 13 Aug 2011, Laruence wrote: >>>>> > >>>>> >> Dear all: >>>>> >> =C2=A0 =C2=A0 I am going to close strn(case)cmp supporting negativ= e length vote, >>>>> >> since it has been calling for vote near two weeks, and no new feed= back >>>>> >> . >>>>> >> >>>>> >> =C2=A0 =C2=A0 the Voting result is: >>>>> >> =C2=A0 =C2=A0 =C2=A0Support : =C2=A06 =C2=A0felipe pajoye pierrick= gwynne tyrael laruence >>>>> >> =C2=A0 =C2=A0 =C2=A0Decline : =C2=A03 =C2=A0iliaa rasmus salathe >>>>> >> >>>>> >> =C2=A0 =C2=A0 it wins 2/3 vote, =C2=A0 so I think this supposed to= mean that accept, =C2=A0right? >>>>> > >>>>> > I voted against too. Also, you started the vote with not even a wee= k >>>>> > between RFC announcement and call for voting, so I guess that makes= this >>>>> > invalid? >>>>> > >>>>> > >>>>> > Just looked over the RFC, and this whole example is weird: >>>>> > >>>>> > >>>> > var_dump(strncmp("prefix_num", "num", -10)); >>>>> > ?> >>>>> > >>>>> > Why does it even find the substring as you can't do "-10" from the = end? >>>>> > If the number is too high, it should give you a warning. >>>>> >>>>> imo the patch is consistent with how substr works: >>>>> tyrael@thor:~$ php -d display_errors=3D1 -d error_reporting=3D-1 -r '= echo >>>>> substr("prefix_num", -100);' >>>>> prefix_num >>>> >>>> Maybe, but I would classify *that* as a bug as it makes no sense at al= l. >>>> >>>> Derick >>>> >>>> -- >>>> http://derickrethans.nl | http://xdebug.org >>>> Like Xdebug? Consider a donation: http://xdebug.org/donate.php >>>> twitter: @derickr and @xdebug >>> >>> >>> >>> -- >>> Laruence =C2=A0Xinchen Hui >>> http://www.laruence.com/ >>> >> >> >> >> -- >> Laruence =C2=A0Xinchen Hui >> http://www.laruence.com/ >> > > > > -- > Laruence =C2=A0Xinchen Hui > http://www.laruence.com/ > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/