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