tony2001                Thu Aug 19 09:59:29 2004 EDT

  Modified files:              
    /php-src/ext/standard       basic_functions.c 
  Log:
  fix #29737 (ip2long should return -1 if IP is 255.255.255.255 and FALSE on error)
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.683&r2=1.684&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.683 
php-src/ext/standard/basic_functions.c:1.684
--- php-src/ext/standard/basic_functions.c:1.683        Tue Aug 10 23:57:15 2004
+++ php-src/ext/standard/basic_functions.c      Thu Aug 19 09:59:29 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.683 2004/08/11 03:57:15 pollita Exp $ */
+/* $Id: basic_functions.c,v 1.684 2004/08/19 13:59:29 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1364,6 +1364,13 @@
        }
 
        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) {
                RETURN_FALSE;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to