dateformat_bug71516.phpt 893 B

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