ID:               40178
 Updated by:       [EMAIL PROTECTED]
 Reported By:      bpita at netcombbs dot com
 Status:           Bogus
 Bug Type:         *Network Functions
 Operating System: Win32, Linux32 and Linux64
 PHP Version:      5.2.0
 New Comment:

"but I use an internal function of php that returns differents values
depends of my processor architecture ? It's correct ? "

No, it is not correct.

It is the _same_ value. But PHP has only signed integer. A signed
integer can be used to store an unsigned integer. But when you display
it, it thinks that is a negative number.

Try:
echo dechex(ip2long("255.255.255.128"));'




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

[2007-01-20 04:08:41] bpita at netcombbs dot com

Thanks, for your answer, I try to understand... but I use an internal
function of php that returns differents values depends of my processor
architecture ? It's correct ? Not should be the same and Php be in
charge of this and return alway the same value independently of the 32b
or 64b processor ?

Thanks, Bernardo.

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

[2007-01-20 02:15:55] [EMAIL PROTECTED]

(bogus means "Not a bug" here)

This is the internal representation of signed integer using unsigned
integer. 32bits use one bit for the sign, that explains the negative
_displayed_ values, but the internal values are the same.

Big numbers should be processed using bcmath or pecl/big_int

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

[2007-01-20 00:50:32] bpita at netcombbs dot com

Description:
------------
Hi,

I use this code in differents operating systems and plataforms (intel
and amd) and return differents results.
It's a bug ? Any comments ?

Thanks, Bernardo.


Reproduce code:
---------------
echo ip2long('255.255.255.128');
echo ip2long('255.255.255.192');
echo ip2long('255.255.255.248');


Expected result:
----------------
32 bits systems returns:

-128
-64
-8

---------------------
64 bits systems returns:

4294967168
4294967232
4294967288




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


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

Reply via email to