Re: [VOTE]strn(case)cmp supporting a negative length as its third paramter

From: Date: Mon, 15 Aug 2011 08:51:01 +0000
Subject: Re: [VOTE]strn(case)cmp supporting a negative length as its third paramter
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  Groups: php.internals 
Request: Send a blank email to internals+get-54620@lists.php.net to get a copy of this message
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 <lester@lsces.co.uk>: > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Laruence  Xinchen Hui http://www.laruence.com/

« previous php.internals (#54620) next »