This piece of code is pretty new; It was written in that way to make it
possible to store IPs.
In what cases do you see a problem with that? If (d) is bigger than
LONG_MAX, than you're screwed anyway.
At 19:20 05-09-01, Gavin Sherry wrote:
>Just looking through some older bugs. #13007 is a bug in the Zend
>engine. The problem is the zval.value.lval is overflowing. The
>zendi_convert_to_long() macro converts doubles to unsigned long ints as
>(l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d);
>It cannot do this since l (zval.value.lval) is signed. This also means
>that other functions using using zendi_convert_to_long() are
>busted: modulus and rest of the bitwise implementation.
>What's the solution? Well, certainly not to make lval unsigned or use long
>long (since some platforms do not support). The main issue is that due to
>the way variables in PHP are initialised, users are given the impression
>that integer variables have no maximum sizes.
>By the same token, it makes no sense to limit bitwise and mod operations
>to numbers under LONG_MAX.
>The easiest hack would be to promote the type of the other value to double
>and return that as the result. But will this break anything?
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]