ID: 14134
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old Status: Analyzed
Status: Suspended
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.0.6
Old Assigned To: derick
Assigned To: 
New Comment:

status -> suspended

Previous Comments:
------------------------------------------------------------------------

[2001-12-12 15:47:39] [EMAIL PROTECTED]

Changing this into a suspended scripting engine problem, as the bug lies in Zend. It 
is possible to change te parsing, but this will need a lot of adjustments in it. 
That's why I'm suspending it too.

Derick



------------------------------------------------------------------------

[2001-11-26 14:42:58] [EMAIL PROTECTED]

s/unsigned/signed in my text... I was sleeping I think :)

Derick

------------------------------------------------------------------------

[2001-11-26 14:35:08] [EMAIL PROTECTED]

Derick,

Can you tell me where this code is so I can have a look? I'm a little confused about 
your comment about conversion to unsigned integers. First, I believe strtol converts 
to a signed integer (and, as used in intval, it does work correctly). But 2147483648 
actually is a valid unsigned long. If the conversion is failing, it must be trying to 
convert to a signed integer.

As for the workaround, creating constants INT_MIN and INT_MAX is exactly what I did, 
although you still have to be careful when creating INT_MIN. It must be something 
like:

define( "INT_MIN", -2147483647 - 1 );
define( "INT_MAX", 2147483647 );


------------------------------------------------------------------------

[2001-11-26 02:37:19] [EMAIL PROTECTED]

Ok, as I have no time to look into a fix (if it's even do-able), I'll explain here why 
it happens:

The parser embedded in PHP, does not take "-2147483648" as a string to convert (with 
strtol) to a unsigned integer, but it instead does this:

1. it tries to convert "2147483648" to a unsigned integer (which fails)
2. it tries to substract this from 0, ie. 0 - 2147483648.

Because the conversion to a unsigned long fails in the first step, it gets converted 
to a floating point number, which is substracted from 0.

A way to solve this can be to add constants for these outher limits, ie. INT_MIN (for 
-2147483648) and INT_MAX (for 2147483647).

Derick

------------------------------------------------------------------------

[2001-11-20 03:31:18] [EMAIL PROTECTED]

Found the problem. I'll try to make a fix this evening.

Derick

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/?id=14134


Edit this bug report at http://bugs.php.net/?id=14134&edit=1


-- 
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