bug42785.phpt 647 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Bug #42785 (Incorrect formatting of double values with non-english locales)
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('json')) die('skip');
  6. if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
  7. die("skip locale needed for this test is not supported on this platform");
  8. }
  9. ?>
  10. --FILE--
  11. <?php
  12. setlocale(LC_ALL, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
  13. $foo = array(100.10,"bar");
  14. var_dump(json_encode($foo));
  15. class bar {}
  16. $bar1 = new bar;
  17. $bar1->a = 100.10;
  18. $bar1->b = "foo";
  19. var_dump(json_encode($bar1));
  20. ?>
  21. --EXPECT--
  22. string(13) "[100.1,"bar"]"
  23. string(21) "{"a":100.1,"b":"foo"}"