xref: /PHP-5.4/ext/json/tests/bug41403.phpt (revision ad0beee0)
1--TEST--
2Bug #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.')
3--SKIPIF--
4<?php
5
6if (!extension_loaded('json')) die('skip');
7
8if (setlocale(LC_NUMERIC, "de_DE") === false) {
9	die("skip no de_DE locale");
10}
11?>
12--INI--
13precision=14
14--FILE--
15<?php
16
17setlocale(LC_NUMERIC, 'de_DE');
18var_dump(json_decode('[2.1]'));
19var_dump(json_decode('[0.15]'));
20var_dump(json_decode('[123.13452345]'));
21var_dump(json_decode('[123,13452345]'));
22
23echo "Done\n";
24?>
25--EXPECTF--
26array(1) {
27  [0]=>
28  float(2,1)
29}
30array(1) {
31  [0]=>
32  float(0,15)
33}
34array(1) {
35  [0]=>
36  float(123,13452345)
37}
38array(2) {
39  [0]=>
40  int(123)
41  [1]=>
42  int(13452345)
43}
44Done
45