Annotation of embedaddon/php/ext/json/tests/bug42785.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #42785 (Incorrect formatting of double values with non-english locales)
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded("json")) {
! 6: print "skip";
! 7: } else if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
! 8: die("skip locale needed for this test is not supported on this platform");
! 9: }
! 10: ?>
! 11: --FILE--
! 12: <?php
! 13: setlocale(LC_ALL, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
! 14:
! 15: $foo = Array(100.10,"bar");
! 16: var_dump(json_encode($foo));
! 17:
! 18: Class bar {}
! 19: $bar1 = new bar;
! 20: $bar1->a = 100.10;
! 21: $bar1->b = "foo";
! 22: var_dump(json_encode($bar1));
! 23: ?>
! 24: --EXPECT--
! 25: string(13) "[100.1,"bar"]"
! 26: string(21) "{"a":100.1,"b":"foo"}"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>