derick          Sat Sep  1 18:38:39 2007 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/standard/tests/network ip_x86_64.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/standard       basic_functions.c 
  Log:
  - MFH: Fixed bug #42512 (ip2long('255.255.255.255') should return 4294967295 
on
    64-bit PHP).
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.922&r2=1.2027.2.547.2.923&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.922 php-src/NEWS:1.2027.2.547.2.923
--- php-src/NEWS:1.2027.2.547.2.922     Sat Sep  1 17:48:41 2007
+++ php-src/NEWS        Sat Sep  1 18:38:38 2007
@@ -4,6 +4,8 @@
 - Added optional parameter $provide_object to debug_backtrace(). (Sebastian)
 - Upgraded PCRE to version 7.3 (Nuno)
 
+- Fixed bug #42512 (ip2long('255.255.255.255') should return 4294967295 on
+  64-bit PHP). (Derick)
 - Fixed bug #42462 (Segmentation when trying to set an attribute in a 
   DOMElement). (Rob)
 - Fixed bug #42453 (CGI SAPI does not shut down cleanly with -i/-m/-v cmdline
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.62&r2=1.725.2.31.2.63&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.62 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.63
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.62      Fri Aug 31 
10:46:19 2007
+++ php-src/ext/standard/basic_functions.c      Sat Sep  1 18:38:38 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.62 2007/08/31 10:46:19 jani Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.63 2007/09/01 18:38:38 derick Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -4340,7 +4340,7 @@
                 */
                if (Z_STRLEN_PP(str) == sizeof("255.255.255.255") - 1 &&
                        !memcmp(Z_STRVAL_PP(str), "255.255.255.255", 
sizeof("255.255.255.255") - 1)) {
-                       RETURN_LONG(-1);
+                       RETURN_LONG(0xFFFFFFFF);
                }
                
                RETURN_FALSE;

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/network/ip_x86_64.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/network/ip_x86_64.phpt
+++ php-src/ext/standard/tests/network/ip_x86_64.phpt
--TEST--
ip2long() & long2ip() tests
--SKIPIF--
<?php
if (PHP_INT_SIZE == 4) die("skip this test is for >32bit platform only");
?>
--FILE--
<?php

$array = array(
        "127.0.0.1",
        "10.0.0.1",
        "255.255.255.255",
        "255.255.255.0",
        "0.0.0.0",
        "66.163.161.116",
);

foreach ($array as $ip) {
        var_dump($long = ip2long($ip));
        var_dump(long2ip($long));
}

var_dump(ip2long());
var_dump(ip2long(""));
var_dump(ip2long("777.777.777.777"));
var_dump(ip2long("111.111.111.111"));
var_dump(ip2long(array()));

var_dump(long2ip());
var_dump(long2ip(-110000));
var_dump(long2ip(""));
var_dump(long2ip(array()));

echo "Done\n";
?>
--EXPECTF--     
int(2130706433)
string(9) "127.0.0.1"
int(167772161)
string(8) "10.0.0.1"
int(4294967295)
string(15) "255.255.255.255"
int(4294967040)
string(13) "255.255.255.0"
int(0)
string(7) "0.0.0.0"
int(1118019956)
string(14) "66.163.161.116"

Warning: Wrong parameter count for ip2long() in %s on line %d
NULL
bool(false)
bool(false)
int(1869573999)

Notice: Array to string conversion in %s on line %d
bool(false)

Warning: Wrong parameter count for long2ip() in %s on line %d
NULL
string(13) "255.254.82.80"
string(7) "0.0.0.0"

Notice: Array to string conversion in %s on line %d
string(7) "0.0.0.0"
Done

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

Reply via email to