From ca28e37be18a58f6554bf84610c3184421490bdd Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 19 Aug 2004 15:14:04 +0000 Subject: [PATCH] fix #29737 in the right way with performance in mind --- ext/standard/basic_functions.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 008ee454325..c52434ad358 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1365,14 +1365,14 @@ PHP_FUNCTION(ip2long) convert_to_string_ex(str); - /* the only special case when we should return -1 ourselves, - * because inet_addr() considers it wrong. - */ - if (!strcasecmp(Z_STRVAL_PP(str), "255.255.255.255")) { - RETURN_LONG(-1); - } - if (Z_STRLEN_PP(str) == 0 || (ip = inet_addr(Z_STRVAL_PP(str))) == INADDR_NONE) { + /* 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))) { + RETURN_LONG(-1); + } + RETURN_FALSE; }