bug41403.phpt 626 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Bug #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.')
  3. --SKIPIF--
  4. <?php
  5. if (setlocale(LC_NUMERIC, "de_DE") === false) {
  6. die("skip no de_DE locale");
  7. }
  8. ?>
  9. --INI--
  10. serialize_precision=-1
  11. --FILE--
  12. <?php
  13. setlocale(LC_NUMERIC, 'de_DE');
  14. var_dump(json_decode('[2.1]'));
  15. var_dump(json_decode('[0.15]'));
  16. var_dump(json_decode('[123.13452345]'));
  17. var_dump(json_decode('[123,13452345]'));
  18. echo "Done\n";
  19. ?>
  20. --EXPECT--
  21. array(1) {
  22. [0]=>
  23. float(2.1)
  24. }
  25. array(1) {
  26. [0]=>
  27. float(0.15)
  28. }
  29. array(1) {
  30. [0]=>
  31. float(123.13452345)
  32. }
  33. array(2) {
  34. [0]=>
  35. int(123)
  36. [1]=>
  37. int(13452345)
  38. }
  39. Done