Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-16 Thread Matt W
Hi Pierre, After checking places where is_numeric... functions are used (http://lxr.php.net/ident?i=is_numeric_string), it looks like changing to allow *trailing* spaces would have an impact in zend_operators.c for at least compare_function() (and I guess increment_function() too). e.g. ('1' == '

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-14 Thread Andrei Zmievski
Guys, I can't keep following endless (and large) email threads about things like that. Could you please work together on a more formal proposal taking into consideration existing state, BC, any potential future issues etc? If you need some guidelines, I quite like how Pythong PEPs do it [

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-12 Thread Pierre
Hello, > This example has nothing to do with what we are discussing here. There > is no conversion or detection involved here. It is a simple string > concatenation. And yet, the way Matt W was talking at one point, it seemed he wanted to change that as well... Or perhaps I misunderstood. I s

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-12 Thread Richard Lynch
On Sat, August 12, 2006 2:19 pm, Pierre wrote: > On 8/12/06, Richard Lynch <[EMAIL PROTECTED]> wrote: > >> But I think you are talking about making changes to the way this >> works: >> >> http://example.com/?foo=%20.123 >> > $foo = $_GET['foo']; >> if (is_numeric($foo)){ >> //error out >> } >> $q

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-12 Thread Pierre
Hello, On 8/12/06, Richard Lynch <[EMAIL PROTECTED]> wrote: But I think you are talking about making changes to the way this works: http://example.com/?foo=%20.123 If you break that, you're in big trouble to a lot of scripts all over the planet, which rely on the leading space to trap their

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-12 Thread Richard Lynch
[Apologies for having accidentally responded to Matt W off-list, and now bringing it back on-list without asking...] On Sat, August 12, 2006 2:50 am, Matt W wrote: > From: "Richard Lynch" > Sent: Friday, August 11, 2006 > > >> Leading whitespace in PHP means that it's not a number, it's a >> strin

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-12 Thread Pierre
Hello, On 8/12/06, Matt W <[EMAIL PROTECTED]> wrote: Hi Pierre, I will reply to the rest of your message later. Just wanted to quickly point out another thing I found with is_numeric_string() when the allow_errors param==0 (which is_numeric() PHP function uses) and there is *trailing* whitespa

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-12 Thread Matt W
Hi Pierre, I will reply to the rest of your message later. Just wanted to quickly point out another thing I found with is_numeric_string() when the allow_errors param==0 (which is_numeric() PHP function uses) and there is *trailing* whitespace: is_numeric('1 ') // bool(false) Again, easy to fi

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-11 Thread Pierre
Hi Matt, On 8/11/06, Matt W <[EMAIL PROTECTED]> wrote: Hello Pierre, Thanks for your reply. :-) - Original Message - From: "Pierre" Sent: Friday, August 11, 2006 > Hello, > > Note that I also answer your previous mail here :) > > On Fri, 11 Aug 2006 06:18:13 -0500 > [EMAIL PROTECTED]

[PHP-DEV] Re: [Simplistic End User View] Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-11 Thread Matt W
Hi Jochem, Leading whitespace is already allowed with PHP's is_numeric() function (and corresponding internal one), math operations, etc. Only when it precedes .123 or -.123 does the behavior change. :-) Matt - Original Message - From: "Jochem Maas" Sent: Friday, August 11, 2006 Pie

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-11 Thread Matt W
Hello Pierre, Thanks for your reply. :-) - Original Message - From: "Pierre" Sent: Friday, August 11, 2006 > Hello, > > Note that I also answer your previous mail here :) > > On Fri, 11 Aug 2006 06:18:13 -0500 > [EMAIL PROTECTED] ("Matt W") wrote: > > > Hello again, > > > > I discovered

[PHP-DEV] [Simplistic End User View] Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-11 Thread Jochem Maas
Pierre wrote: > Hello, > > Note that I also answer your previous mail here :) > > On Fri, 11 Aug 2006 06:18:13 -0500 > [EMAIL PROTECTED] ("Matt W") wrote: > >> Hello again, >> >> I discovered a couple more things is_numeric... is causing problems >> with (leading whitespace). I doubt any of the

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-11 Thread Pierre
Hello, Note that I also answer your previous mail here :) On Fri, 11 Aug 2006 06:18:13 -0500 [EMAIL PROTECTED] ("Matt W") wrote: > Hello again, > > I discovered a couple more things is_numeric... is causing problems > with (leading whitespace). I doubt any of the examples I've given > make sen

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-11 Thread Pierre
Hello, Note that I also answer your previous mail here :) On Fri, 11 Aug 2006 06:18:13 -0500 [EMAIL PROTECTED] ("Matt W") wrote: > Hello again, > > I discovered a couple more things is_numeric... is causing problems > with (leading whitespace). I doubt any of the examples I've given > make sen

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-11 Thread Matt W
Hi Andrei, You seem to be the array-function-person ;-) so I'll ask you if the array_count_values() result in my previous message is what's intended? Seems to me leading whitespace should *not* be ignored. I didn't try it yet, but it seems zend_[u_]symtable_[find|update] should simply be used, in

Re: [PHP-DEV] is_numeric_string causes function inconsistency

2006-08-11 Thread Matt W
Hello again, I discovered a couple more things is_numeric... is causing problems with (leading whitespace). I doubt any of the examples I've given make sense to regular users who don't know what's happening behind the scenes. Add these to the "wrong" list: is_numeric(' .123') // bool(false) ' .

[PHP-DEV] is_numeric_string causes function inconsistency

2006-08-06 Thread Matt W
Hi all, Since I've been looking at is_numeric_[string|unicode], I found a weird thing it causes; probably doesn't make sense to users; bug? Look: abs(-1e500) // float(INF) abs('-1e500') // int(1) WRONG abs('-1e100') // float(1.0E+100) is_finite(1e500) // bool(false) is_finite('1e500') // bool(t