#29705 [Opn]: ip2long returns false instead of -1 for "255.255.255.255"
| From: | derick@php.net | Date: | Mon, 16 Aug 2004 12:36:20 +0000 |
| Subject: | #29705 [Opn]: ip2long returns false instead of -1 for "255.255.255.255" | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969363218@lists.php.net to get a copy of this message | ||
ID: 29705
Updated by: derick@php.net
Reported By: andrew at is dot co dot za
Status: Open
-Bug Type: Network related
+Bug Type: Documentation problem
Operating System: FreeBSD 4.6.2-RELEASE-p23
PHP Version: 5.0.0
New Comment:
This is correct, it changed from 4.x to 5.0.0 (read the release
notes).
This should be fixed in the documentation though.
Previous Comments:
------------------------------------------------------------------------
[2004-08-16 13:14:02] andrew at is dot co dot za
Description:
------------
ip2long has been changed to return "false" instead of -1 in the event
of a failure, presumably to fix the historical problem of not being
able to pass it "255.255.255.255", which is a valid broadcast address
that evaluates to -1 when converted.
However, ip2long now returns "false" instead of -1 for
"255.255.255.255", which contradicts the PHP documentation.
Reproduce code:
---------------
if (ip2long("255.255.255.255") === false) {
echo "Bad";
} else {
echo "OK";
}
Expected result:
----------------
Displays "Bad"
Actual result:
--------------
Should display "OK"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29705&edit=1