mirror of
https://github.com/php/php-src.git
synced 2026-04-18 05:21:02 +02:00
Fix byteorder for il2long and long2ip (#6159)
@- Fix byte order for ip2long and long2ip (Stas)
This commit is contained in:
@@ -802,7 +802,7 @@ PHP_FUNCTION(ip2long)
|
||||
|
||||
convert_to_string_ex(str);
|
||||
|
||||
RETURN_LONG(inet_addr((*str)->value.str.val));
|
||||
RETURN_LONG(ntohl(inet_addr((*str)->value.str.val)));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -818,7 +818,7 @@ PHP_FUNCTION(long2ip)
|
||||
}
|
||||
|
||||
convert_to_long_ex(num);
|
||||
myaddr.s_addr = (unsigned long)(*num)->value.lval;
|
||||
myaddr.s_addr = htonl((unsigned long)(*num)->value.lval);
|
||||
|
||||
RETURN_STRING (inet_ntoa(myaddr), 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user