summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-10-01 15:33:11 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-10-01 15:33:11 +0000
commitc3cf6cb069e657eb9daeb80fdabca744a3c103ac (patch)
treeada431b1328a4cf760aab708b1e96d35d0b953d1 /ext
parent36cf6a2b051a2f67b747f02e0f0b3eb1525be48f (diff)
downloadphp-git-c3cf6cb069e657eb9daeb80fdabca744a3c103ac.tar.gz
Added test for bug #42785
Diffstat (limited to 'ext')
-rw-r--r--ext/json/tests/bug42785.phpt26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/json/tests/bug42785.phpt b/ext/json/tests/bug42785.phpt
new file mode 100644
index 0000000000..7bdadbed1e
--- /dev/null
+++ b/ext/json/tests/bug42785.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #42785 (Incorrect formatting of double values with non-english locales)
+--SKIPIF--
+<?php
+ if (!extension_loaded("json")) {
+ print "skip";
+ } else if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
+ die("skip locale needed for this test is not supported on this platform");
+ }
+?>
+--FILE--
+<?php
+setlocale(LC_ALL, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
+
+$foo = Array(100.10,"bar");
+var_dump(json_encode($foo));
+
+Class bar {}
+$bar1 = new bar;
+$bar1->a = 100.10;
+$bar1->b = "foo";
+var_dump(json_encode($bar1));
+?>
+--EXPECT--
+string(13) "[100.1,"bar"]"
+string(21) "{"a":100.1,"b":"foo"}"