xref: /PHP-5.6/ext/json/tests/bug40503.phpt (revision e5abc537)
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 json_test_show_eq($x, $y) {
10	echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n";
11}
12
13$value = 0x7FFFFFFF; #2147483647;
14json_test_show_eq("$value", json_encode($value));
15$value++;
16json_test_show_eq("$value", json_encode($value));
17
18?>
19--EXPECT--
202147483647 == 2147483647
212147483648 == 2147483648
22