Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54617 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5397 invoked from network); 15 Aug 2011 08:24:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2011 08:24:30 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 213.123.20.125 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 213.123.20.125 c2bthomr07.btconnect.com Received: from [213.123.20.125] ([213.123.20.125:56768] helo=mail.btconnect.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/21-31518-9B7D84E4 for ; Mon, 15 Aug 2011 04:24:26 -0400 Received: from host81-138-11-136.in-addr.btopenworld.com (EHLO _10.0.0.4_) ([81.138.11.136]) by c2bthomr07.btconnect.com with ESMTP id EDF23375; Mon, 15 Aug 2011 09:20:56 +0100 (BST) Message-ID: <4E48D6E7.2000203@lsces.co.uk> Date: Mon, 15 Aug 2011 09:20:55 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.19) Gecko/20110420 SUSE/2.0.14-2.2 SeaMonkey/2.0.14 MIME-Version: 1.0 To: PHP Internals 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> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0303.4E48D6E7.00CF, actions=TAG X-Junkmail-Premium-Raw: score=7/50, refid=2.7.2:2011.7.19.51514:17:7.586, ip=81.138.11.136, rules=__MOZILLA_MSGID, __HAS_MSGID, __SANE_MSGID, __USER_AGENT, __MIME_VERSION, __TO_MALFORMED_2, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __CT, __CT_TEXT_PLAIN, __CTE, __ANY_URI, __URI_NO_MAILTO, __CP_URI_IN_BODY, __CP_AGE_BODY, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, RDNS_SUSP, BODY_SIZE_7000_LESS X-Junkmail-Status: score=10/50, host=c2bthomr07.btconnect.com X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B0205.4E48D7B6.010F:SCFSTAT14830815,ss=1,fgs=0, ip=0.0.0.0, so=2010-07-22 22:03:31, dmn=2009-09-10 00:05:08, mode=multiengine X-Junkmail-IWF: false Subject: Re: [PHP-DEV] [VOTE]strn(case)cmp supporting a negative length as its third paramter From: lester@lsces.co.uk (Lester Caine) Laruence wrote: > yes, substr_compare can do it, and it also supports negative > 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 intermittently, and usually when 10 year old code has been working fine and suddenly starts doing it? All of the original base str... functions currently follow the libc manual ( 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 sure 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 rest? > but I am proposal to improve strn(case)cmp, so they are not conflict .:) One persons improvement can become someone elses BC nightmare? I seem to recall a discussion about tidying up many of the string functions, 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 same 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 tidy 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=contact 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