xref: /PHP-5.4/ext/json/tests/bug40503.phpt (revision 66859a74)
1--TEST--
2Bug #40503 (json_encode() value corruption on 32bit systems with overflown values)
3--INI--
4precision=14
5--SKIPIF--
6<?php if (!extension_loaded("json")) print "skip"; ?>
7--FILE--
8<?php
9function show_eq($x,$y) {
10	echo "$x ". ($x==$y ? "==" : "!=") ." $y\n";
11}
12
13$value = 0x7FFFFFFF; #2147483647;
14show_eq("$value", json_encode($value));
15$value++;
16show_eq("$value", json_encode($value));
17
18?>
19--EXPECT--
202147483647 == 2147483647
212147483648 == 2147483648
22