From: jr-php2 at quo dot to
Operating system: Linux x86-64
PHP version: 5.2.4
PHP Bug Type: Network related
Bug description: ip2long('255.255.255.255') should return 4294967295 on 64-bit
PHP
Description:
------------
On 64-bit platforms, ip2long() returns a positive result for IP addresses
>= 128.0.0.0. This is expected.
However, there is *one* case in which it will return a negative result:
when the specified address is 255.255.255.255.
This inconsistency doesn't make sense. Yes, the documentation does say
that ip2long() returns -1 for 255.255.255.255, but that should only be the
case on 32-bit platforms, where all addresses >= 128.0.0.0 return a
negative result.
Reproduce code:
---------------
echo "ip2long('255.255.255.254') = ", ip2long('255.255.255.254'), "\n";
echo "ip2long('255.255.255.255') = ", ip2long('255.255.255.255'), "\n";
Expected result:
----------------
ip2long('255.255.255.254') = 4294967294
ip2long('255.255.255.255') = 4294967295
Actual result:
--------------
ip2long('255.255.255.254') = 4294967294
ip2long('255.255.255.255') = -1
--
Edit bug report at http://bugs.php.net/?id=42512&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42512&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42512&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42512&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42512&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42512&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42512&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42512&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42512&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42512&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42512&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42512&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42512&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42512&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42512&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42512&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42512&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42512&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42512&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42512&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42512&r=mysqlcfg