Skip to content

Commit

Permalink
- Fixed ip2long() behavior if an invalid IP address was passed to the
Browse files Browse the repository at this point in the history
  function. This makes it possible to distingiush between "255.255.255.255"
  and a wrong one.
  • Loading branch information
Derick Rethans committed May 28, 2004
1 parent 9797f49 commit f964cc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/basic_functions.c
Expand Up @@ -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));
Expand Down

0 comments on commit f964cc0

Please sign in to comment.