Re: [PHP-DEV] Zend engine bug

2001-09-06 Thread Gavin Sherry
On Thu, 6 Sep 2001, Stanislav Malyshev wrote: > GS>> echo (2147483649 & 2147483649); > GS>> > GS>> echo (2147483649 % 5); > > If you want numbers longer than long, you should use GMP anyway (or should > know what you are doing). That unsigned hack, IIRC, was made with the > single purpose of ena

Re: [PHP-DEV] Zend engine bug

2001-09-06 Thread Stanislav Malyshev
GS>> echo (2147483649 & 2147483649); GS>> GS>> echo (2147483649 % 5); If you want numbers longer than long, you should use GMP anyway (or should know what you are doing). That unsigned hack, IIRC, was made with the single purpose of enabling working with IPs, etc. -- Stanislav Malyshev, Zend Pro

Re: [PHP-DEV] Zend engine bug

2001-09-06 Thread Stanislav Malyshev
GS>> It cannot do this since l (zval.value.lval) is signed. This also means GS>> that other functions using using zendi_convert_to_long() are GS>> busted: modulus and rest of the bitwise implementation. Oh, that's an old weird story. In short, we have two contradicting requirements: 1. We have 'l

Re: [PHP-DEV] Zend engine bug

2001-09-05 Thread Gavin Sherry
On Wed, 5 Sep 2001, Zeev Suraski wrote: > >If the type of either operand is greater than long, it cannot be demoted > >(from double) without overflowing lval and giving unexpected results. > > But when you overflow an integer, you get unexpected results. The only > thing this code does is that

Re: [PHP-DEV] Zend engine bug

2001-09-05 Thread Zeev Suraski
At 19:58 05-09-01, Gavin Sherry wrote: >On Wed, 5 Sep 2001, Zeev Suraski wrote: > > > In what cases do you see a problem with that? If (d) is bigger than > > LONG_MAX, than you're screwed anyway. > >I presume you are refering to my proposed hack? Perhaps a little more >detail =). Nope :) I was

Re: [PHP-DEV] Zend engine bug

2001-09-05 Thread Gavin Sherry
On Wed, 5 Sep 2001, Zeev Suraski wrote: > In what cases do you see a problem with that? If (d) is bigger than > LONG_MAX, than you're screwed anyway. I presume you are refering to my proposed hack? Perhaps a little more detail =). If the type of either operand is greater than long, it cannot

Re: [PHP-DEV] Zend engine bug

2001-09-05 Thread Zeev Suraski
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. Zeev At 19:20 05-09-01, Gavin Sherry wrote: >Hi guys, > >Just looking through some older b

[PHP-DEV] Zend engine bug

2001-09-05 Thread Gavin Sherry
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 follows: (l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d); It cannot do this s