#29737 [Opn->Csd]: ip2long() works not as documented

From: Date: Thu, 07 Apr 2005 16:03:01 +0000
Subject: #29737 [Opn->Csd]: ip2long() works not as documented
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76494@lists.php.net to get a copy of this message
 ID:               29737
 Updated by:       sniper@php.net
 Reported By:      belikoviv at is dot lg dot ua
-Status:           Open
+Status:           Closed
 Bug Type:         Network related
 Operating System: Windows 2000 SP4; Fedora Core 2
 PHP Version:      5.0.0
 New Comment:

It behaves the same in PHP 4. No bug here.



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

[2005-04-06 15:27:04] vrana@php.net

The function is returning -1 also for any substring of
"255.255.255.255" (e.g. "" or "255.") but it should return FALSE.

memcmp(Z_STRVAL_PP(str), "255.255.255.255", Z_STRLEN_PP(str)) should be
replaced by strcmp(Z_STRVAL_PP(str), "255.255.255.255").

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

[2005-04-06 15:23:10] vrana@php.net

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.

"ip2long() will return FALSE for the IP 255.255.255.255 in PHP 5 <=
5.0.2. It was fixed in PHP 5.0.3 where it returns -1 (same as PHP 4)."

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

[2005-04-06 12:16:43] belikoviv at is dot lg dot ua

Function ip2long() fixed long time ago, but now I see incorrect note in
documentation (at bottom of the chapter):

"Note:  ip2long() will return -1 (PHP 4) or FALSE (PHP 5) for the IP
255.255.255.255"

This is incorrect. ip2long returns -1 in both PHP4 and PHP5 for IP
255.255.255.255. Value "-1" is _correct_ value for 255.255.255.255, so
that note must be deleted from documentation. Note about PHP4 is exist
near the top of chapter.

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

[2004-08-19 18:18:25] belikoviv at is dot lg dot ua

Sorry, but problem not fixed - I try php5-win32-latest.zip and
php5.0-win32-200408190830.zip. Both snapshots return FALSE on address
255.255.255.255.

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

[2004-08-19 16:04:35] tony2001@php.net

Fixed in CVS, thanks.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/29737

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


Thread (9 messages)

« previous php.bugs (#76494) next »