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

2011-08-15 Thread Nikita Popov
On Mon, Aug 15, 2011 at 10:20 AM, Lester Caine wrote: > Perhaps it should be linked in the SeeAlso from strncmp and the rest? I added substr_compare to the See Also sections of strcmp, strcasecmp, strncmp and strncasecmp. Apart from that: Now that we know that a function for doing such comparison

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

2011-08-15 Thread Ryan McCue
Laruence wrote: > I think we are not talking about how to accomplish a function, we > are talking about how to do it better > > and, in fact, I think strrev is need more cpu time and alloc space, > although they are very tiny :) I very much doubt it's ever going to be a bottleneck (and I thi

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

2011-08-15 Thread Laruence
Hi Rasmus: could we well docuemnt this(changelog) to avoding such bad thing happen? and sure, I agree and know what you are worried, also I am very respect you . so here is the thing, if I can't get your support, I think I should darw back the proposal. thanks 2011/8/15 Rasmus Lerd

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

2011-08-15 Thread Lester Caine
Laruence wrote: 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

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

2011-08-15 Thread Rasmus Lerdorf
On 08/15/2011 01:51 AM, Laruence wrote: > 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 cod

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

2011-08-15 Thread 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? th

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

2011-08-15 Thread Stas Malyshev
Hi! On 8/15/11 1:20 AM, Lester Caine wrote: 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::

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

2011-08-15 Thread 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 bee

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

2011-08-15 Thread Laruence
Hi: I think we are not talking about how to accomplish a function, we are talking about how to do it better and, in fact, I think strrev is need more cpu time and alloc space, although they are very tiny :) thanks 2011/8/15 Sebastian Krebs : > > > Am 14.08.2011 23:52, schrieb Rasmus Lerdor

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

2011-08-14 Thread Laruence
Hi Tjerk: yes, substr_compare can do it, and it also supports negative length argument too. but I am proposal to improve strn(case)cmp, so they are not conflict . :) thanks 2011/8/15 Tjerk Anne Meesters : > Hi, > > Doesn't substr_compare() accomplish the same thing since 5.1.0? > > The o

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

2011-08-14 Thread Sebastian Krebs
Am 14.08.2011 23:52, schrieb Rasmus Lerdorf: On 08/14/2011 02:37 PM, Rasmus Lerdorf wrote: On 08/14/2011 02:03 PM, Stas Malyshev wrote: Hi! On 8/14/11 11:40 AM, Rasmus Lerdorf wrote: My main issue with changing strncmp/strncasecmp is that these are currently exact mappings of the underlying

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

2011-08-14 Thread Tjerk Anne Meesters
Hi, Doesn't substr_compare() accomplish the same thing since 5.1.0? The only thing I couldn't figure out is how to make it case insensitive without specifying an explicit value to $length Best, Tjerk On Mon, Aug 15, 2011 at 11:18 AM, Laruence wrote: > Hi: >   compare to use substr,   strncm

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

2011-08-14 Thread Laruence
Hi: compare to use substr, strncmp supporting negative lenght can save a temp variable. thanks 2011/8/15 Rasmus Lerdorf : > On 08/14/2011 02:37 PM, Rasmus Lerdorf wrote: >> On 08/14/2011 02:03 PM, Stas Malyshev wrote: >>> Hi! >>> >>> On 8/14/11 11:40 AM, Rasmus Lerdorf wrote: My main is

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

2011-08-14 Thread Rasmus Lerdorf
On 08/14/2011 02:37 PM, Rasmus Lerdorf wrote: > On 08/14/2011 02:03 PM, Stas Malyshev wrote: >> Hi! >> >> On 8/14/11 11:40 AM, Rasmus Lerdorf wrote: >>> My main issue with changing strncmp/strncasecmp is that these are >>> currently exact mappings of the underlying libc functions. For people >> >>

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

2011-08-14 Thread Rasmus Lerdorf
On 08/14/2011 02:03 PM, Stas Malyshev wrote: > Hi! > > On 8/14/11 11:40 AM, Rasmus Lerdorf wrote: >> My main issue with changing strncmp/strncasecmp is that these are >> currently exact mappings of the underlying libc functions. For people > > And why should anybody care? 99% of people using PHP

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

2011-08-14 Thread Stas Malyshev
Hi! On 8/14/11 11:40 AM, Rasmus Lerdorf wrote: My main issue with changing strncmp/strncasecmp is that these are currently exact mappings of the underlying libc functions. For people And why should anybody care? 99% of people using PHP never used a libc function and can hardly tell libc from

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

2011-08-14 Thread Rasmus Lerdorf
On 08/14/2011 11:26 AM, Stas Malyshev wrote: > Hi! > >>> Maybe, but I would classify *that* as a bug as it makes no sense at all. > > Thinking more about it, something like: > > if(strncasecmp($filename, ".php", -4) === 0) { > /* got php file! */ > } > > seems to me just fine and better than

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

2011-08-14 Thread Stas Malyshev
Hi! On 8/13/11 5:17 AM, Laruence wrote: Dear all: I am going to close strn(case)cmp supporting negative length vote, since it has been calling for vote near two weeks, and no new feedback I think we need some more time to discuss it. Give it a week, then let's see. -- Stanislav Malyshev

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

2011-08-14 Thread Stas Malyshev
Hi! Maybe, but I would classify *that* as a bug as it makes no sense at all. Thinking more about it, something like: if(strncasecmp($filename, ".php", -4) === 0) { /* got php file! */ } seems to me just fine and better than doing the same with substr. I would definitely be against the war

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

2011-08-14 Thread Stas Malyshev
Hi! imo the patch is consistent with how substr works: tyrael@thor:~$ php -d display_errors=1 -d error_reporting=-1 -r 'echo substr("prefix_num", -100);' prefix_num Maybe, but I would classify *that* as a bug as it makes no sense at all. It makes some sense, if you take the meaning of argume

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

2011-08-14 Thread Laruence
Hi: sorry, the example is wrong , it should be : thanks 2011/8/14 Laruence : > Hi all internalers: >    Since there comes some new objections,  I think I should open the > RFC voteing again. > >    to Derick,  if I extended voting phase for two weeks ,  can we > consider  this voteing va

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

2011-08-14 Thread Laruence
Hi all internalers: Since there comes some new objections, I think I should open the RFC voteing again. to Derick, if I extended voting phase for two weeks , can we consider this voteing valid? I think this proposal is not explained clearly before, so I am going to explain it agia

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

2011-08-14 Thread Laruence
Hi: I think what I was done is try to describe a image, that we can make follow codes more simple: if (strncmp(substr("num_suffix", 0, -5), "suffix", 5) == 0) { echo "they have the same suffix"; } yes, there is must something not good in my patch, but I think I can tweak it as

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

2011-08-14 Thread Laruence
Hi: this just to say that stncasecmp has the same behavior of either negative or postive length argument. why you insist to this point? as strncmp("", "bbb", 100) works with no warning, why negative length need trigger warnings? thanks 2011/8/14 Derick Rethans : > On Sun, 14 Aug

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

2011-08-14 Thread Ferenc Kovacs
>> imo the patch is consistent with how substr works: >> tyrael@thor:~$ php -d display_errors=1 -d error_reporting=-1 -r 'echo >> substr("prefix_num", -100);' >> prefix_num > > Maybe, but I would classify *that* as a bug as it makes no sense at all. > I don't mind that, and imho laruence would be

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

2011-08-14 Thread Derick Rethans
On Sun, 14 Aug 2011, Ferenc Kovacs wrote: > On Sun, Aug 14, 2011 at 1:24 PM, Derick Rethans wrote: > > On Sat, 13 Aug 2011, Laruence wrote: > > > >> Dear all: > >>     I am going to close strn(case)cmp supporting negative length vote, > >> since it has been calling for vote near two weeks, and no

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

2011-08-14 Thread Ferenc Kovacs
On Sun, Aug 14, 2011 at 1:24 PM, Derick Rethans wrote: > On Sat, 13 Aug 2011, Laruence wrote: > >> Dear all: >>     I am going to close strn(case)cmp supporting negative length vote, >> since it has been calling for vote near two weeks, and no new feedback >> . >> >>     the Voting result is: >>  

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

2011-08-14 Thread Derick Rethans
On Sat, 13 Aug 2011, Laruence wrote: > Dear all: > I am going to close strn(case)cmp supporting negative length vote, > since it has been calling for vote near two weeks, and no new feedback > . > > the Voting result is: > Support : 6 felipe pajoye pierrick gwynne tyrael laruence >

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

2011-08-13 Thread Laruence
Dear all: I am going to close strn(case)cmp supporting negative length vote, since it has been calling for vote near two weeks, and no new feedback . the Voting result is: Support : 6 felipe pajoye pierrick gwynne tyrael laruence Decline : 3 iliaa rasmus salathe it wins

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

2011-08-05 Thread Laruence
HI: and I don't think this was diffcult to accepted it was a little improve, and make a litte change, even no bc break... thanks 2011/8/6 Laruence : > Hi: >  I am not good at english, so I could not explain the idea very clearly >  but I really think it was a good idea,, > >  could someone

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

2011-08-05 Thread Laruence
Hi: I am not good at english, so I could not explain the idea very clearly but I really think it was a good idea,, could someone plz make a decision that make this patch applied to svn trunk? thanks 2011/8/2 Jan Dolecek : > This would make perfect sense with constant strings and constant > l

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

2011-08-02 Thread Jan Dolecek
This would make perfect sense with constant strings and constant length, when using variables this may lead to some magic bugs, which would be normally reported as E_WARNING. Not sure if it's a good idea :( Jan Dolecek juzna...@gmail.com On Mon, Aug 1, 2011 at 7:40 AM, Laruence wrote: > Hi eve

[PHP-DEV] [VOTE]strn(case)cmp supporting a negative length as its third paramter

2011-07-31 Thread Laruence
Hi everyone: plz vote for this : "strn(case)cmp supporting a negative length as its third paramter" RFC: https://wiki.php.net/rfc/strncmpnegativelen#vote if you have any objection, plz write back. thanks -- Laruence  Xinchen Hui http://www.laruence.com/ -- PHP Internals - PHP Runtim