]> granicus.if.org Git - php/commitdiff
- Fixed ip2long() behavior if an invalid IP address was passed to the
authorDerick Rethans <derick@php.net>
Fri, 28 May 2004 10:45:18 +0000 (10:45 +0000)
committerDerick Rethans <derick@php.net>
Fri, 28 May 2004 10:45:18 +0000 (10:45 +0000)
  function. This makes it possible to distingiush between "255.255.255.255"
  and a wrong one.

NEWS
ext/standard/basic_functions.c

diff --git a/NEWS b/NEWS
index 88a95df6df5a75d2d010b36b42d125c06447e776..fbb5c4596f9e783550670f50db0a028db3db5ae7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ PHP                                                                        NEWS
 - Changed class type hints for function parameters to not allow the passing of
   NULL values. (Andi)
 - Changed tidy_node to tidyNode and removed tidy_exception. (John)
+- Fixed ip2long() to return FALSE if an IP address passed to this function
+  is not valid. (Derick)
 - Fixed memory leak in memory manager. (Andi)
 - Fixed problem with exceptions returning from include(). (Dmitry)
 - Fixed bug #28311 (Transparency detection code is off by 1).
index 6fcab6d761175ac2d36bd3c67f92d9bde591c4cc..425d6a494f6c92504054dcb0dd3216ea60844df2 100644 (file)
@@ -1247,7 +1247,7 @@ PHP_FUNCTION(ip2long)
        convert_to_string_ex(str);
 
        if (Z_STRLEN_PP(str) == 0 || (ip = inet_addr(Z_STRVAL_PP(str))) == INADDR_NONE) {
-               RETURN_LONG(-1);
+               RETURN_FALSE;
        }
 
        RETURN_LONG(ntohl(ip));