mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.2' into PHP-8.3
This commit is contained in:
commit
d9e72bcdab
3 changed files with 28 additions and 0 deletions
2
NEWS
2
NEWS
|
@ -24,6 +24,8 @@ PHP NEWS
|
|||
- Intl:
|
||||
. Fixed bug GH-12243 (segfault on IntlDateFormatter::construct).
|
||||
(David Carlier)
|
||||
. Fixed bug GH-12282 (IntlDateFormatter::construct should throw an exception
|
||||
on an invalid locale). (David Carlier)
|
||||
|
||||
- SimpleXML:
|
||||
. Fixed bug GH-12170 (Can't use xpath with comments in SimpleXML). (nielsdos)
|
||||
|
|
|
@ -111,6 +111,11 @@ static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handlin
|
|||
locale_str = (char *) intl_locale_get_default();
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/* process calendar */
|
||||
if (datefmt_process_calendar_arg(calendar_obj, calendar_long, calendar_is_null, locale, "datefmt_create",
|
||||
|
|
21
ext/intl/tests/gh12282.phpt
Normal file
21
ext/intl/tests/gh12282.phpt
Normal file
|
@ -0,0 +1,21 @@
|
|||
--TEST--
|
||||
GitHub #12282 IntlDateFormatter::locale with invalid value.
|
||||
--EXTENSIONS--
|
||||
intl
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new IntlDateFormatter(
|
||||
'xx',
|
||||
IntlDateFormatter::FULL,
|
||||
IntlDateFormatter::FULL,
|
||||
null,
|
||||
null,
|
||||
'w'
|
||||
);
|
||||
} catch (\IntlException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
--EXPECT--
|
||||
datefmt_create: invalid locale: U_ILLEGAL_ARGUMENT_ERROR
|
Loading…
Add table
Add a link
Reference in a new issue