xref: /PHP-7.2/ext/json/tests/bug40503.phpt (revision 2fd0b994)
1--TEST--
2Bug #40503 (json_encode() value corruption on 32bit systems with overflown values)
3--INI--
4serialize_precision=-1
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