Re: '9223372036854775807' == '9223372036854775808'

From: Date: Fri, 13 Apr 2012 18:40:06 +0000
Subject: Re: '9223372036854775807' == '9223372036854775808'
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-59896@lists.php.net to get a copy of this message
On 04/13/2012 09:12 AM, Rasmus Lerdorf wrote:
On 04/13/2012 09:09 AM, Stas Malyshev wrote:
However I think it would make sense not to use this conversion in string comparisons when we know it's lossy - it seems to be outside of the use case for such comparisons and it seems apparent by now that it is hard for people to understand why it works this way.
Yup, I agree, if the type juggling loses data we should skip the juggle and do a direct comparison which I think is what Gustavo's patch does. If people explicitly cast things then the cast, even if it is lossy, should happen. -Rasmus
Sadly when I proposed this many months ago my post was ignored. :-( Just chiming in to say +1 for this type of operation. This problem was extremely frustrating and took a while to figure out exactly what was going on, as I had wrongly assumed casting to string at the comparison would cause a strcmp. -Matt

« previous php.internals (#59896) next »