]> granicus.if.org Git - php/commitdiff
Fix for bug #9698.
authorSean Bright <elixer@php.net>
Wed, 21 Mar 2001 13:53:38 +0000 (13:53 +0000)
committerSean Bright <elixer@php.net>
Wed, 21 Mar 2001 13:53:38 +0000 (13:53 +0000)
# Anyone that can think of a way to fix long2ip(), feel free.

ext/standard/basic_functions.c

index bf2142d7e703a795c5e5633c64532503ce58944b..573b6d48c7d731774037b65d6b7d3202c24c2803 100644 (file)
@@ -924,6 +924,7 @@ PHP_FUNCTION(constant)
 PHP_FUNCTION(ip2long)
 {
        zval **str;
+       char tmp_buff[16];
 
        if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
                WRONG_PARAM_COUNT;
@@ -931,7 +932,9 @@ PHP_FUNCTION(ip2long)
 
        convert_to_string_ex(str);
 
-       RETURN_LONG(ntohl(inet_addr(Z_STRVAL_PP(str))));
+       sprintf(tmp_buff, "%u", ntohl(inet_addr(Z_STRVAL_PP(str))));
+
+       RETURN_STRING(tmp_buff,1);
 }
 /* }}} */