#16020 [NoF->Bgs]: long2ip Returns Incorrect Results
| From: | nohn@php.net | Date: | Fri, 16 Aug 2002 03:21:29 +0000 |
| Subject: | #16020 [NoF->Bgs]: long2ip Returns Incorrect Results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-16980@lists.php.net to get a copy of this message | ||
ID: 16020
Updated by: nohn@php.net
Reported By: lee@nerds.org.uk
-Status: No Feedback
+Status: Bogus
Bug Type: Math related
Operating System: FreeBSD 4.4-STABLE i386
PHP Version: 4.1.2
New Comment:
Duplicate of http://bugs.php.net/bug.php?id=18816
?
Previous Comments:
------------------------------------------------------------------------
[2002-08-10 01:00:11] php-bugs@lists.php.net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2002-07-07 20:54:01] sniper@php.net
I was unable to reproduce this with latest CVS.
Please try this snapshot:
http://snaps.php.net/php4-latest.tar.gz
------------------------------------------------------------------------
[2002-03-19 07:02:42] lee@nerds.org.uk
Another thing that might help narrow down what is happening is that is
you use ip2long to convert an address above 127.255.255.255 the integer
you get back is negative.
I presume that this means that somewhere in the code this is stored as
a signed integer as opposed to an unsigned long?
------------------------------------------------------------------------
[2002-03-13 15:25:31] lee@nerds.org.uk
In which case I would suspect that this is a platform dependent bug, as
I have reproduced this on more than one FreeBSD machine, of different
versions (all 4.x) on differing processors.
Presumably as this works fine when the address is presented as an int
and not as a string, the problem lies in converting the string to an
integer value, before it is tranformed into dotted octet notation?
If this is the case then it is probably some .h file being misdetected
by the configure script??? </GUESS>
Also another pointer to problems is that if you use a number that
requires more than 16 bits, then the returned address is always
127.255.255.255, which is quite a significant number.
My guess (although I am by no means an expert) is that in using some
function like strtoul we are loosing the long or the unsigned
attributes of the integer and so accidentally passing incorrect (16 bit
number instead of 32??) information about??
------------------------------------------------------------------------
[2002-03-13 14:38:13] sander@php.net
Strange... you script works fine for me...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/16020
--
Edit this bug report at http://bugs.php.net/?id=16020&edit=1