dateformat_bug71516.phpt 982 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Bug #71516 IntlDateFormatter losts locale if pattern is set via constructor
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
  6. --FILE--
  7. <?php
  8. $loc = "ru_RU";
  9. $goodFormatter = new IntlDateFormatter($loc, IntlDateFormatter::FULL, IntlDateFormatter::FULL, new DateTimeZone("UTC"));
  10. $badFormatter = new IntlDateFormatter($loc, IntlDateFormatter::FULL, IntlDateFormatter::FULL, new DateTimeZone("UTC"), null, "d MMM");
  11. $badFormatter2 = new IntlDateFormatter($loc, IntlDateFormatter::FULL, IntlDateFormatter::FULL, new DateTimeZone("UTC"));
  12. $badFormatter2->setPattern("d MMM");
  13. echo "Formatter without pattern: " . $goodFormatter->getLocale() . PHP_EOL;
  14. echo "Formatter with pattern: " . $badFormatter->getLocale() . PHP_EOL;
  15. echo "Formatter with pattern set later: " . $badFormatter2->getLocale() . PHP_EOL;
  16. ?>
  17. ==DONE==
  18. --EXPECT--
  19. Formatter without pattern: ru
  20. Formatter with pattern: ru
  21. Formatter with pattern set later: ru
  22. ==DONE==