ID: 41946
Updated by: [EMAIL PROTECTED]
Reported By: youare at loss4words dot com
-Status: Assigned
+Status: Closed
Bug Type: Network related
Operating System: Debian 4.0
PHP Version: 5.1
Assigned To: jani
New Comment:
Fixed in CVS. Fix will be as of 5.2.4.
Previous Comments:
------------------------------------------------------------------------
[2007-08-16 12:25:11] [EMAIL PROTECTED]
ip2long should return -1 only for 255.255.255.255. Empty string should
result in FALSE.
------------------------------------------------------------------------
[2007-07-10 07:19:00] youare at loss4words dot com
Description:
------------
Documentation for ip2long needs a little more detail. It says that it
returns FALSE if the argument passed is not a valid IP address, and says
this returned -1 before version 5.
It should also mention that if it is passed an empty argument that it
will still return -1.
Reproduce code:
---------------
<?php
echo "<br />Result: " . ip2long("10.10.10.10"); // returns long
echo "<br />Result: " . ip2long("not.an.ip.address"); // returns FALSE
echo "<br />Result: " . ip2long(""); // should return FALSE, returns
-1
?>
Expected result:
----------------
Result: 168430090
Result:
Result:
Actual result:
--------------
Result: 168430090
Result:
Result: -1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41946&edit=1