ID:               29737
 User updated by:  belikoviv at is dot lg dot ua
 Reported By:      belikoviv at is dot lg dot ua
 Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Windows 2000 SP4; Fedora Core 2
 PHP Version:      5.0.0
 New Comment:

I think that problem not in documentation, but in function itself.

Address 255.255.255.255 is _valid_ address, and function must return
0xffffffff (-1), not FALSE.

In versions before 5.0 ip2long was return -1 in both situations - as
error and in case of addres=255.255.255.255. This is not good solution,
and, as I think, authors rewrite function to return FALSE in case of
invalid IP and return -1 in case of IP=255.255.255.255. And this
behavior of function was written in documentation, so documentation
_is_ correct.

Sorry for so many words in bad English :(


Previous Comments:
------------------------------------------------------------------------

[2004-08-19 07:57:24] [EMAIL PROTECTED]

This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------

[2004-08-18 16:55:35] belikoviv at is dot lg dot ua

Description:
------------
Documentation (from 16-08-2004) says:
"Note: ip2long() will return -1 for the IP 255.255.255.255"
Instead it returns FALSE.


Reproduce code:
---------------
#!/usr/local/bin/php
<?php
$ip = "255.255.255.255";
$long = ip2long ( $ip );//  if ( $long === FALSE ) $long = -1;
echo $ip, "\t", $long, "\t", long2ip ( $long ), "\n";
?>


Expected result:
----------------
255.255.255.255 -1 255.255.255.255


Actual result:
--------------
255.255.255.255  0.0.0.0



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29737&edit=1

Reply via email to