Hi guys,

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]

Reply via email to