Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54620 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11059 invoked from network); 15 Aug 2011 08:51:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2011 08:51:06 -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.220.170 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:33030] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/32-31518-7FDD84E4 for ; Mon, 15 Aug 2011 04:51:05 -0400 Received: by vxh24 with SMTP id 24so4106890vxh.29 for ; Mon, 15 Aug 2011 01:51:01 -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=JXgU9I4+U98ent91Wjp17w+W0thyx2mP8eAkvjI3GB0=; b=uuHP4JvN2Ky0ZluAYj+IXpkzo4g0QWpDdRNrXGXvwZYloBADeobqQ7btoxsBmJYXml tdSuNiStsI8Gzt99L7W5KYI20nEtylAQYNr22HfOPtjsvVpAlkTWYC1dUMuaBLh6lV9O GCRurYS7WoNiLUpexMfnOvsgfaw2YCxfaAWfs= MIME-Version: 1.0 Received: by 10.220.210.195 with SMTP id gl3mr917105vcb.190.1313398261317; Mon, 15 Aug 2011 01:51:01 -0700 (PDT) Sender: laruence@gmail.com Received: by 10.220.184.76 with HTTP; Mon, 15 Aug 2011 01:51:01 -0700 (PDT) In-Reply-To: <4E48D6E7.2000203@lsces.co.uk> References: <4E48121A.3090007@sugarcrm.com> <4E48134E.4030708@sugarcrm.com> <4E481695.6040900@php.net> <4E483804.7070009@sugarcrm.com> <4E484037.2080107@php.net> <4E4843B0.70605@php.net> <4E48D6E7.2000203@lsces.co.uk> Date: Mon, 15 Aug 2011 16:51:01 +0800 X-Google-Sender-Auth: NJQSyLDl1MOTw9NpK9FZQ_Uisl8 Message-ID: To: Lester Caine Cc: PHP Internals 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 Lester: I totally agree with you about bc break things, but actully I don't think this proposal will bring a big bc break, it's a new approach , but not a big change, I am meaning that the old codes can work fine because rarely codes depends on a negative length. do you agree? thanks 2011/8/15 Lester Caine : > Laruence wrote: >> >> =C2=A0 =C2=A0yes, =C2=A0substr_compare can do it, and it also supports n= egative >> length argument too. > > I am with Rasmus ... while the BC problem he is pointing out is probably > very rare, those are the worse ones to fix when they pop up intermittentl= y, > and usually when 10 year old code has been working fine and suddenly star= ts > doing it? > > All of the original base str... functions currently follow the libc manua= l ( > I think ) and that is how they work. My first thought when the thread > started was that this needed a different name - which is exactly why > substr_compare exists? Although nothing is appearing in my archive, I'm s= ure > that this discussion has already happened long ago when this was added to > PHP5? Perhaps it should be linked in the SeeAlso from strncmp and the res= t? > >> =C2=A0 =C2=A0 but I am proposal to improve strn(case)cmp, so they are no= t =C2=A0conflict >> .:) > > One persons improvement can become someone elses BC nightmare? > > I seem to recall a discussion about tidying up many of the string functio= ns, > probably part of unicode compatibility, and in that vane, would it be > possible to create a 'namespace' version of string functions which could = be > a little more consistent, and also offer the chance to switch to full > unicode comparison if required? sb:: -> mb:: transparently working the sa= me > way? needle and haystack order comes to mind as well? > > Is there any reason there is not an mb_substr_compare ? > Yes character based rather than byte. Seems to me that this is the way to= go > rather than changing the other functions? Actually substr_compare will ti= dy > up a bit of a mess in my own code where I need to switch case on and off = I'd > just not remembered it existed .... > > -- > Lester Caine - G8HFL > ----------------------------- > Contact - http://lsces.co.uk/wiki/?page=3Dcontact > L.S.Caine Electronic Services - http://lsces.co.uk > EnquirySolve - http://enquirysolve.com/ > Model Engineers Digital Workshop - http://medw.co.uk// > Firebird - http://www.firebirdsql.org/index.php > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/