summaryrefslogtreecommitdiff
path: root/ext/json/tests
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-02-18 16:54:59 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-02-18 16:54:59 +0000
commit5e274ea47d2d31894b775fc8c171db88ee061c2e (patch)
tree2fac646495f4746fa861aab7cf889e4a0aaccf3c /ext/json/tests
parent05584eb55a55816fdfe7ed4913d97334abec4f6c (diff)
downloadphp-git-5e274ea47d2d31894b775fc8c171db88ee061c2e.tar.gz
Fixed bug #40503 (json_encode() value corruption on 32bit systems with
overflown values).
Diffstat (limited to 'ext/json/tests')
-rw-r--r--ext/json/tests/bug40503.phpt19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/json/tests/bug40503.phpt b/ext/json/tests/bug40503.phpt
new file mode 100644
index 0000000000..d451eea35d
--- /dev/null
+++ b/ext/json/tests/bug40503.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #40503 (json_encode() value corruption on 32bit systems with overflown values)
+--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