ID: 27710 Updated by: [EMAIL PROTECTED] Reported By: phpbug at labres dot at Status: Open -Bug Type: Math related +Bug Type: Documentation problem Operating System: Linux, FreeBSD PHP Version: 4.3.4 New Comment:
Yup, it should be. Previous Comments: ------------------------------------------------------------------------ [2004-03-26 09:09:10] phpbug at labres dot at I've now read the documentation of inet_addr(), so this is a feature. Maybe it should be documented. ------------------------------------------------------------------------ [2004-03-26 05:21:20] phpbug at labres dot at tested on different OS'es. ------------------------------------------------------------------------ [2004-03-26 05:11:48] phpbug at labres dot at Description: ------------ When given network addresses (partial ip addresses)*), ip2long() calculates erratic values: Input Output dechex should be 192 int(192) c0 c0000000 192.168 int(-1073741656) c00000a8 c0a80000 192.168.1 int(-1062731775) c0a80001 c0a80100 *) you will need this to convert 192/8, 192.168/16 etc network addresses. Reproduce code: --------------- $net=ip2long("192"); echo dechex($net)."\n"; $net=ip2long("192.168"); echo dechex($net)."\n"; $net=ip2long("192.168.1"); echo dechex($net)."\n"; Expected result: ---------------- c0000000 c0a80000 c0a80100 Actual result: -------------- c0 c00000a8 c0a80001 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27710&edit=1