|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-09-01 18:29 UTC] derick@php.net
[2007-09-01 18:38 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 16:00:01 2025 UTC |
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