summaryrefslogtreecommitdiff
path: root/ext/json/tests/bug40503.phpt
blob: 48f18a4e0f55751103b9d88beac766ef84db8a6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
Bug #40503 (json_encode() value corruption on 32bit systems with overflown values)
--INI--
precision=14
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
function show_eq($x,$y) {
	echo "$x ". ($x==$y ? "==" : "!=") ." $y\n";
}

$value = 0x7FFFFFFF; #2147483647;
show_eq("$value", json_encode($value));
$value++;
show_eq("$value", json_encode($value));

?>
--EXPECT--
2147483647 == 2147483647
2147483648 == 2147483648