Annotation of embedaddon/php/ext/standard/tests/strings/bug47842.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #47842 sscanf() does not support 64-bit values
! 3: --SKIPIF--
! 4: <?php
! 5: if (PHP_INT_MAX < pow(2,31)) die("skip PHP_INT_MAX < 32b\n");
! 6: ?>
! 7: --FILE--
! 8: <?php
! 9: echo "-Test\n";
! 10:
! 11: sscanf("2147483647", '%d', $int);
! 12: echo "sscanf 32-bit signed int '2147483647' (2^31)-1 = ",$int,"\n";
! 13: sscanf("4294967295", '%u', $int);
! 14: echo "sscanf 32-bit unsign int '4294967295' (2^32)-1 = ",$int,"\n";
! 15:
! 16: sscanf("9223372036854775807", '%d', $int);
! 17: echo "sscanf 64-bit signed int '9223372036854775807' (2^63)-1 = ",$int,"\n";
! 18: sscanf("18446744073709551615", '%u', $int);
! 19: echo "sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = ",$int,"\n";
! 20:
! 21: printf("printf 64-bit signed int '9223372036854775807' (2^63)-1 = %d\n", 9223372036854775807);
! 22: printf("printf 64-bit signed int '18446744073709551615' (2^64)-1 = %u\n", 18446744073709551615);
! 23:
! 24: echo "Done\n";
! 25: ?>
! 26: --EXPECTF--
! 27: %aTest
! 28: sscanf 32-bit signed int '2147483647' (2^31)-1 = 2147483647
! 29: sscanf 32-bit unsign int '4294967295' (2^32)-1 = 4294967295
! 30: sscanf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807
! 31: sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = 18446744073709551615
! 32: printf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807
! 33: printf 64-bit signed int '18446744073709551615' (2^64)-1 = 0
! 34: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>