From: Jani Taskinen Date: Thu, 16 Aug 2007 22:17:10 +0000 (+0000) Subject: MFH:- Fix bug #41946 (ip2long("") should return FALSE) X-Git-Tag: php-5.2.4RC2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3e6f47ea110bdd303588b16c76fe83940dc991a;p=php MFH:- Fix bug #41946 (ip2long("") should return FALSE) --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 64ebbaad3d..b6ed033203 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4338,7 +4338,7 @@ PHP_FUNCTION(ip2long) /* the only special case when we should return -1 ourselves, * because inet_addr() considers it wrong. */ - if (!memcmp(Z_STRVAL_PP(str), "255.255.255.255", Z_STRLEN_PP(str))) { + if (!memcmp(Z_STRVAL_PP(str), "255.255.255.255", sizeof("255.255.255.255") - 1)) { RETURN_LONG(-1); } diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt index 794c2d38c9..c7d550fac6 100644 --- a/ext/standard/tests/network/ip.phpt +++ b/ext/standard/tests/network/ip.phpt @@ -50,7 +50,7 @@ string(14) "66.163.161.116" Warning: Wrong parameter count for ip2long() in %s on line %d NULL -int(-1) +bool(false) bool(false) int(1869573999)