1--TEST--
2Bug #47842      sscanf() does not support 64-bit values
3--SKIPIF--
4<?php
5if (PHP_INT_MAX < pow(2,31)) die("skip PHP_INT_MAX < 32b\n");
6?>
7--FILE--
8<?php
9echo "-Test\n";
10
11sscanf("2147483647", '%d', $int);
12echo "sscanf 32-bit signed int '2147483647'           (2^31)-1 = ",$int,"\n";
13sscanf("4294967295", '%u', $int);
14echo "sscanf 32-bit unsign int '4294967295'           (2^32)-1 = ",$int,"\n";
15
16sscanf("9223372036854775807", '%d', $int);
17echo "sscanf 64-bit signed int '9223372036854775807'  (2^63)-1 = ",$int,"\n";
18sscanf("18446744073709551615", '%u', $int);
19echo "sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = ",$int,"\n";
20
21printf("printf 64-bit signed int '9223372036854775807'  (2^63)-1 = %d\n", 9223372036854775807);
22printf("printf 64-bit signed int '18446744073709551615' (2^64)-1 = %u\n", 18446744073709551615);
23
24echo "Done\n";
25?>
26--EXPECTF--
27%aTest
28sscanf 32-bit signed int '2147483647'           (2^31)-1 = 2147483647
29sscanf 32-bit unsign int '4294967295'           (2^32)-1 = 4294967295
30sscanf 64-bit signed int '9223372036854775807'  (2^63)-1 = 9223372036854775807
31sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = 18446744073709551615
32printf 64-bit signed int '9223372036854775807'  (2^63)-1 = 9223372036854775807
33printf 64-bit signed int '18446744073709551615' (2^64)-1 = 0
34Done
35