tony2001                Thu Aug 19 10:03:45 2004 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src/ext/standard       basic_functions.c 
  Log:
  MFH: 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.673.2.2&r2=1.673.2.3&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.673.2.2 
php-src/ext/standard/basic_functions.c:1.673.2.3
--- php-src/ext/standard/basic_functions.c:1.673.2.2    Wed Aug 11 00:10:44 2004
+++ php-src/ext/standard/basic_functions.c      Thu Aug 19 10:03:44 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.673.2.2 2004/08/11 04:10:44 pollita Exp $ */
+/* $Id: basic_functions.c,v 1.673.2.3 2004/08/19 14:03:44 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1279,6 +1279,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