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