Skip to content

Commit da1313e

Browse files
committed
ext/intl: use PATTERN constant name in dateformat errors
1 parent 16b3bbc commit da1313e

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

NEWS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ PHP NEWS
88
and IntlGregorianCalendar date/time construction. (Weilin Du)
99
. Expose Spoofchecker restriction-level APIs on all supported ICU
1010
versions. (Weilin Du)
11-
. Fix SpoofChecker::setAllowedChars() to report PHP constant names
12-
instead of ICU USET_* names in invalid pattern option errors.
11+
. Fix SpoofChecker::setAllowedChars() and IntlDateFormatter::__construct()
12+
to report PHP constant names instead of ICU constant names in
13+
user-visible error messages.
1314
(Weilin Du)
1415

1516
- MySQLnd:

UPGRADING

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ PHP 8.4 UPGRADE NOTES
9292
- ValueError if the integer index does not fit in a signed 32 bit integer
9393
. IntlDateFormatter::__construct() throws a ValueError if the locale is invalid.
9494
. NumberFormatter::__construct() throws a ValueError if the locale is invalid.
95-
. SpoofChecker::setAllowedChars() now reports PHP constant names instead
96-
of ICU USET_* names in invalid pattern option errors.
95+
. SpoofChecker::setAllowedChars() and IntlDateFormatter::__construct()
96+
now report PHP constant names instead of ICU constant names in
97+
user-visible error messages.
9798
. MBString:
9899
. mb_encode_numericentity() and mb_decode_numericentity() now check that
99100
the $map is only composed of integers, if not a ValueError is thrown.

ext/intl/dateformat/dateformat_create.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handlin
103103
return FAILURE;
104104
}
105105
if (date_type == UDAT_PATTERN && time_type != UDAT_PATTERN) {
106-
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: time format must be UDAT_PATTERN if date format is UDAT_PATTERN", 0);
106+
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: time format must be IntlDateFormatter::PATTERN if date format is IntlDateFormatter::PATTERN", 0);
107107
return FAILURE;
108108
}
109109

ext/intl/tests/gh12243.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
GitHub #12043 segfault with IntlDateFormatter::dateType where it equals to UDAT_PATTERN (icu 50) but
2+
GitHub #12043 segfault with IntlDateFormatter::dateType where it equals to IntlDateFormatter::PATTERN (icu 50) but
33
IntldateFormatter::timeType needs to be set as such.
44
--EXTENSIONS--
55
intl
@@ -21,4 +21,4 @@ try {
2121

2222
?>
2323
--EXPECT--
24-
datefmt_create: time format must be UDAT_PATTERN if date format is UDAT_PATTERN: U_ILLEGAL_ARGUMENT_ERROR
24+
datefmt_create: time format must be IntlDateFormatter::PATTERN if date format is IntlDateFormatter::PATTERN: U_ILLEGAL_ARGUMENT_ERROR

0 commit comments

Comments
 (0)