php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41946 Minor detail missing in documentation.
Submitted: 2007-07-10 07:19 UTC Modified: 2007-08-16 22:18 UTC
From: youare at loss4words dot com Assigned: jani (profile)
Status: Closed Package: Network related
PHP Version: 5.1 OS: Debian 4.0
Private report: No CVE-ID: None
 [2007-07-10 07:19 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-16 12:25 UTC] vrana@php.net
ip2long should return -1 only for 255.255.255.255. Empty string should result in FALSE.
 [2007-08-16 22:18 UTC] jani@php.net
Fixed in CVS. Fix will be as of 5.2.4.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 04:01:27 2024 UTC