ID:               18816
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Linux, Tru64
 PHP Version:      4CVS-2002-08-08
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2002-08-10 06:59:59] [EMAIL PROTECTED]

All functions that requrie unsigned int may be affected.

BTW, PostgreSQL OID is free from this restriction, since I changed
source to use string if value is larger than 2^31. So postgreSQL
document can be left as is.


------------------------------------------------------------------------

[2002-08-08 17:01:31] [EMAIL PROTECTED]

Reopened this. This should definitly be documented! On ip2long
documentation it is, on crc32 it is not. Which other functions are
affected by this?

------------------------------------------------------------------------

[2002-08-08 16:23:55] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is because you are using 2 different architectures, on X86 (AMD
k6) ints are 32 bit, but on Compaq Tru64 (ALpha EV68) they are 64 bit.
Since PHP uses signed ints you got a negative number on X86 where
signed ints are limited to 2147483647 and your result is >3 billion.

If you explicitly tell PHP to output an unsigned number it will work
correctly.

printf("%u", ip2long('192.168.0.1'));
-----
3232235521

Same logic applies to your crc, example.

------------------------------------------------------------------------

[2002-08-08 16:09:58] [EMAIL PROTECTED]

Ahh... Please note that I may not be reachable in the next days for
questions, but you may use http://www.testdrive.compaq.com/ to verify
this

------------------------------------------------------------------------

[2002-08-08 16:08:45] [EMAIL PROTECTED]

Following Script produces this output:

  $ip = "192.168.0.1";

  echo("$ip\n");
  echo(ip2long($ip));
----
On Debian/i386 (AMD K6):

192.168.0.1
-1062731775
----
On Compaq Tru64 (ALpha EV68):
192.168.0.1
3232235521

===========================================================================================================


Following Script produces this output:

  $text = "Der schnelle braune Fuchs springt über den blöden Hund.";

  echo "$text\n";
  echo(crc32($text));

----
On Debian/i386 (AMD K6):

Der schnelle braune Fuchs springt über den blöden Hund.
-2050320634
----
On Compaq Tru64 (Alpha EV68):
Der schnelle braune Fuchs springt über den blöden Hund.
1367081892

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=18816&edit=1


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

Reply via email to