]> granicus.if.org Git - php/commitdiff
MFH: ip2long() issues
authorAntony Dovgal <tony2001@php.net>
Thu, 19 Aug 2004 15:15:32 +0000 (15:15 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 19 Aug 2004 15:15:32 +0000 (15:15 +0000)
ext/standard/basic_functions.c

index 9e0bf9bf5e64a70e02287c574b04a6a47cfe0e74..0cbf957a1316460598635ceda3757467fbee7e25 100644 (file)
@@ -1280,14 +1280,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;
        }