summaryrefslogtreecommitdiff
path: root/ext/json/tests/bug41403.phpt
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-05-16 12:54:30 +0000
committerAntony Dovgal <tony2001@php.net>2007-05-16 12:54:30 +0000
commit09a575a20fd47c506f1cb4d0365f8cff2904fcba (patch)
treec2990bc468851b96a6c36471e7415ef2cc59055f /ext/json/tests/bug41403.phpt
parent69650d0ebf188eecec26fcd82729cd042b4ca7f9 (diff)
downloadphp-git-09a575a20fd47c506f1cb4d0365f8cff2904fcba.tar.gz
MFH: fix #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.')
Diffstat (limited to 'ext/json/tests/bug41403.phpt')
-rw-r--r--ext/json/tests/bug41403.phpt41
1 files changed, 41 insertions, 0 deletions
diff --git a/ext/json/tests/bug41403.phpt b/ext/json/tests/bug41403.phpt
new file mode 100644
index 0000000000..80576c85b1
--- /dev/null
+++ b/ext/json/tests/bug41403.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Bug #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.')
+--SKIPIF--
+<?php
+if (setlocale(LC_NUMERIC, "de_DE") === false) {
+ die("skip no de_DE locale");
+}
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+
+setlocale(LC_NUMERIC, 'de_DE');
+var_dump(json_decode('[2.1]'));
+var_dump(json_decode('[0.15]'));
+var_dump(json_decode('[123.13452345]'));
+var_dump(json_decode('[123,13452345]'));
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ float(2,1)
+}
+array(1) {
+ [0]=>
+ float(0,15)
+}
+array(1) {
+ [0]=>
+ float(123,13452345)
+}
+array(2) {
+ [0]=>
+ int(123)
+ [1]=>
+ int(13452345)
+}
+Done