Doc #62440 [Opn->Asn]: parameter in ip2long function
| From: | googleguy@php.net | Date: | Wed, 18 Jul 2012 18:43:51 +0000 |
| Subject: | Doc #62440 [Opn->Asn]: parameter in ip2long function | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8570@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62440&edit=1
ID: 62440
Updated by: googleguy@php.net
Reported by: billsion at gmail dot com
Summary: parameter in ip2long function
-Status: Open
+Status: Assigned
Type: Documentation Problem
Package: Network related
Operating System: Ubuntu 10.0.4, php version 5.3.2
PHP Version: Irrelevant
-Assigned To:
+Assigned To: googleguy@php.ne
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2012-06-28 15:58:41] billsion at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.ip2long#refsect1-function.ip2long-examples
---
Test script:
---------------
<?php
$ip = long2ip(ip2long("10.0.0")); // "0.0.0.0"
$ip = long2ip(ip2long("10.0.256")); // "0.0.0.0"
?>
consult to the documentation of these two example. the two line of codes will return valid IP
address. but in fact, in PHP 5.3.2, it return 0.0.0.0.
<?php
echo ip2long('127.0.256'); //return 0.0.0.0
echo ip2long('127.0.255.0');//return 0.0.0.0
?>
Expected result:
----------------
refer to the documentation:
<?php
$ip = long2ip(ip2long("10.0.0")); // "10.0.0.0"
$ip = long2ip(ip2long("10.0.256")); // "10.0.1.0"
?>
it will return 10.0.0.0 and 10.0.1.0 in my environment, but it's not, it returned 0.0.0.0. the
documentation said that the parameter required a standard format address. parameters in example are
not standard format address, and it's return value is not correct.
This snippet of example should be correct.
Actual result:
--------------
<?php
$ip = long2ip(ip2long("10.0.0")); // "10.0.0.0"
$ip = long2ip(ip2long("10.0.256")); // "10.0.1.0"
?>
actual result is 0.0.0.0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62440&edit=1