xref: /PHP-8.3/ext/json/tests/bug40503.phpt (revision 32a1ebbd)
1--TEST--
2Bug #40503 (json_encode() value corruption on 32bit systems with overflown values)
3--INI--
4serialize_precision=-1
5--FILE--
6<?php
7function json_test_show_eq($x, $y) {
8    echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n";
9}
10
11$value = 0x7FFFFFFF; #2147483647;
12json_test_show_eq("$value", json_encode($value));
13$value++;
14json_test_show_eq("$value", json_encode($value));
15
16?>
17--EXPECT--
182147483647 == 2147483647
192147483648 == 2147483648
20