Doc #62440 [Asn->Csd]: parameter in ip2long function

From: Date: Wed, 18 Jul 2012 19:49:52 +0000
Subject: Doc #62440 [Asn->Csd]: parameter in ip2long function
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8572@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: Assigned +Status: Closed Type: Documentation Problem Package: Network related Operating System: Ubuntu 10.0.4, php version 5.3.2 PHP Version: Irrelevant Assigned To: googleguy@php.ne Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Hi, this example has been removed as it was not valid behavior. The function is documented to return a boolean false on failure (see change log note for PHP version 5.2.10 on the documentation page). Please allow time for the mirrors to update. Thank you for making the PHP documentation better! Previous Comments: ------------------------------------------------------------------------ [2012-07-18 19:43:13] googleguy@php.net Automatic comment from SVN on behalf of googleguy Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=326693 Log: Removed invalid example. which fixes Bug #62440 ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#8572) next »