]> granicus.if.org Git - php/commitdiff
- MFB: #36306, crc32() result differs on 32-bit and 64-bit platforms
authorPierre Joye <pajoye@php.net>
Tue, 7 Feb 2006 00:24:56 +0000 (00:24 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 7 Feb 2006 00:24:56 +0000 (00:24 +0000)
ext/standard/crc32.c
ext/standard/tests/strings/bug36306.phpt [new file with mode: 0644]

index ffac9ee144ac185e79e9cbf6ef40195861d5195e..02bc54e623fd636dbc0a9fd47c2ab30904fc307b 100644 (file)
@@ -38,7 +38,7 @@ PHP_NAMED_FUNCTION(php_if_crc32)
        for (len += nr; nr--; ++p) {
            CRC32(crc, *p);
        }
-       RETVAL_LONG(~crc);
+       RETVAL_LONG(~ (long) crc);
 }
 /* }}} */
 
diff --git a/ext/standard/tests/strings/bug36306.phpt b/ext/standard/tests/strings/bug36306.phpt
new file mode 100644 (file)
index 0000000..a4a02dd
--- /dev/null
@@ -0,0 +1,8 @@
+--TEST--
+Bug #36306 crc32() 64bit
+--FILE--
+<?php
+echo crc32("platform independant") . "\n";
+?>
+--EXPECT--
+-858128794