From 040927ed7946fb15cb2e3934db8a137f8794f32b Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 30 Oct 2023 13:42:50 +0000 Subject: [PATCH] ext/intl: change when the locale is invalid for the 8.1/8.2 serie. does not throws an exception as it's considered as a too string change, but the code user still needs to double check. --- ext/intl/dateformat/dateformat_create.cpp | 3 +-- ext/intl/tests/gh12282.phpt | 15 ++++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index e14eb4f1a2f8a..5c96f41fadf35 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -113,8 +113,7 @@ static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handlin locale = Locale::createFromName(locale_str); /* get*Name accessors being set does not preclude being bogus */ if (locale.isBogus() || strlen(locale.getISO3Language()) == 0) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: invalid locale", 0); - return FAILURE; + goto error; } /* process calendar */ diff --git a/ext/intl/tests/gh12282.phpt b/ext/intl/tests/gh12282.phpt index 62d090ba6166b..a30899a08c7d0 100644 --- a/ext/intl/tests/gh12282.phpt +++ b/ext/intl/tests/gh12282.phpt @@ -5,17 +5,18 @@ intl --FILE-- getMessage(); -} +)); +Locale::setDefault('xx'); +var_dump(new IntlDateFormatter(Locale::getDefault())); --EXPECT-- -datefmt_create: invalid locale: U_ILLEGAL_ARGUMENT_ERROR +object(IntlDateFormatter)#1 (0) { +} +object(IntlDateFormatter)#1 (0) { +}