diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index e14eb4f1a2f8..5c96f41fadf3 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 62d090ba6166..a30899a08c7d 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) { +}