bug42785.phpt 637 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. Bug #42785 (Incorrect formatting of double values with non-english locales)
  3. --INI--
  4. serialize_precision=-1
  5. --SKIPIF--
  6. <?php
  7. 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. $foo = array(100.10,"bar");
  15. var_dump(json_encode($foo));
  16. class bar {}
  17. $bar1 = new bar;
  18. $bar1->a = 100.10;
  19. $bar1->b = "foo";
  20. var_dump(json_encode($bar1));
  21. ?>
  22. --EXPECT--
  23. string(13) "[100.1,"bar"]"
  24. string(21) "{"a":100.1,"b":"foo"}"