Doc #62440 [NEW]: parameter in ip2long function
| From: | billsion at gmail dot com | Date: | Thu, 28 Jun 2012 15:58:41 +0000 |
| Subject: | Doc #62440 [NEW]: parameter in ip2long function | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8510@lists.php.net to get a copy of this message | ||
From: billsion at gmail dot com
Operating system: Ubuntu 10.0.4, php version 5.3.2
PHP version: Irrelevant
Package: Network related
Bug Type: Documentation Problem
Bug description:parameter in ip2long function
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 bug report at https://bugs.php.net/bug.php?id=62440&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62440&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62440&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62440&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62440&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62440&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62440&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62440&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62440&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62440&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62440&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62440&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62440&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62440&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62440&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62440&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62440&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62440&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62440&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62440&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62440&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62440&r=mysqlcfg