Fix GH-12727: NumberFormatter constructor throws an exception on invalid locale.

Also re-establishing exception throwing on IntlDateFormatter constructor
overwritten by accident most likely so postponing it for next major
release.

Close GH-12868
This commit is contained in:
David Carlier 2023-12-04 22:00:17 +00:00
parent d751e61504
commit 683e787860
7 changed files with 57 additions and 18 deletions

View file

@ -113,7 +113,8 @@ 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) {
goto error;
zend_argument_value_error(1, "\"%s\" is invalid", locale_str);
return FAILURE;
}
/* process calendar */