xref: /PHP-8.3/ext/intl/tests/gh12243.phpt (revision 84c4336a)
1--TEST--
2GitHub #12043 segfault with IntlDateFormatter::dateType where it equals to UDAT_PATTERN (icu 50) but
3IntldateFormatter::timeType needs to be set as such.
4--EXTENSIONS--
5intl
6--FILE--
7<?php
8
9$datetime = new \DateTime('2017-05-12 23:11:00 GMT+2');
10static $UDAT_PATTERN = -2;
11
12try {
13    new IntlDateFormatter(
14	    locale: 'en',
15	    dateType: $UDAT_PATTERN,
16	    timeType: 0,
17	    timezone: $datetime->getTimezone(),
18    );
19} catch (\IntlException $e) {
20    echo $e->getMessage();
21}
22
23--EXPECT--
24datefmt_create: time format must be UDAT_PATTERN if date format is UDAT_PATTERN: U_ILLEGAL_ARGUMENT_ERROR
25