summaryrefslogtreecommitdiff
path: root/ext/json/tests
diff options
context:
space:
mode:
authorAdam Harvey <aharvey@php.net>2012-12-11 19:53:02 +0800
committerAdam Harvey <aharvey@php.net>2012-12-11 19:53:02 +0800
commit8bb106d20c8f36d814772c45d693af2b42b06732 (patch)
treed74c57495064766cc8eb69946de768ba9262f9a8 /ext/json/tests
parentec83534d88da4c96777b86d8db7fd20a52ed012e (diff)
parent2d1694d4ebd51ab61f12e6bc545a17e3baf3b4a0 (diff)
downloadphp-git-8bb106d20c8f36d814772c45d693af2b42b06732.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Alter php_json_decode_ex() to respect JSON_BIGINT_AS_STRING for bare numbers.
Diffstat (limited to 'ext/json/tests')
-rw-r--r--ext/json/tests/bug63737.phpt32
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/json/tests/bug63737.phpt b/ext/json/tests/bug63737.phpt
new file mode 100644
index 0000000000..1fb06d485e
--- /dev/null
+++ b/ext/json/tests/bug63737.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #63737 (json_decode does not properly decode with options parameter)
+--SKIPIF--
+<?php if (!extension_loaded("json")) print "skip"; ?>
+--FILE--
+<?php
+function decode($json) {
+ $x = json_decode($json);
+ var_dump($x);
+ $x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
+ var_dump($x);
+}
+
+decode('123456789012345678901234567890');
+decode('-123456789012345678901234567890');
+
+// This shouldn't affect floats, but let's check that.
+decode('123456789012345678901234567890.1');
+decode('-123456789012345678901234567890.1');
+
+echo "Done\n";
+?>
+--EXPECT--
+float(1.2345678901235E+29)
+string(30) "123456789012345678901234567890"
+float(-1.2345678901235E+29)
+string(31) "-123456789012345678901234567890"
+float(1.2345678901235E+29)
+float(1.2345678901235E+29)
+float(-1.2345678901235E+29)
+float(-1.2345678901235E+29)
+Done