summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2004-05-28 10:45:18 +0000
committerDerick Rethans <derick@php.net>2004-05-28 10:45:18 +0000
commitf964cc09d2b4537c27c291fac1d2124f62fa1a3f (patch)
tree250e3ba7c4c8252e16ad935670a893205c81f5c4
parent9797f494669a48fc965465efb9dc07960e536cb8 (diff)
downloadphp-git-f964cc09d2b4537c27c291fac1d2124f62fa1a3f.tar.gz
- Fixed ip2long() behavior if an invalid IP address was passed to the
function. This makes it possible to distingiush between "255.255.255.255" and a wrong one.
-rw-r--r--NEWS2
-rw-r--r--ext/standard/basic_functions.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 88a95df6df..fbb5c4596f 100644
--- 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).
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 6fcab6d761..425d6a494f 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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));