1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/int: IntlTimeZone converting few intl error to exceptions. (#13477)

This commit is contained in:
David CARLIER
2025-08-09 12:50:35 +01:00
committed by GitHub
parent 74c006fbab
commit 2bb98cd8c8
2 changed files with 7 additions and 7 deletions

View File

@@ -14,4 +14,4 @@ try {
} }
?> ?>
--EXPECT-- --EXPECT--
ValueError: IntlTimeZone::createTimeZoneIDEnumeration(): Argument #1 ($type) must be between -2147483648 and 2147483647 ValueError: IntlTimeZone::createTimeZoneIDEnumeration(): Argument #3 ($rawOffset) must be between -2147483648 and 2147483647

View File

@@ -82,9 +82,8 @@ U_CFUNC PHP_FUNCTION(intltz_from_date_time_zone)
tzobj = Z_PHPTIMEZONE_P(zv_timezone); tzobj = Z_PHPTIMEZONE_P(zv_timezone);
if (!tzobj->initialized) { if (!tzobj->initialized) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, zend_throw_error(NULL, "DateTimeZone object is unconstructed");
"DateTimeZone object is unconstructed"); RETURN_THROWS();
RETURN_NULL();
} }
tz = timezone_convert_datetimezone(tzobj->type, tzobj, false, NULL); tz = timezone_convert_datetimezone(tzobj->type, tzobj, false, NULL);
@@ -209,7 +208,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
if (!arg3isnull) { if (!arg3isnull) {
if (UNEXPECTED(ZEND_LONG_EXCEEDS_INT(offset_arg))) { if (UNEXPECTED(ZEND_LONG_EXCEEDS_INT(offset_arg))) {
zend_argument_value_error(1, "must be between %d and %d", INT32_MIN, INT32_MAX); zend_argument_value_error(3, "must be between %d and %d", INT32_MIN, INT32_MAX);
RETURN_THROWS(); RETURN_THROWS();
} }
offset = static_cast<int32_t>(offset_arg); offset = static_cast<int32_t>(offset_arg);
@@ -311,8 +310,9 @@ U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id)
Z_PARAM_LONG(index) Z_PARAM_LONG(index)
ZEND_PARSE_PARAMETERS_END(); ZEND_PARSE_PARAMETERS_END();
if (UNEXPECTED(index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX)) { if (UNEXPECTED(ZEND_LONG_EXCEEDS_INT(index))) {
RETURN_FALSE; zend_argument_value_error(2, "must be between %d and %d", INT32_MIN, INT32_MAX);
RETURN_THROWS();
} }
UErrorCode status = UErrorCode(); UErrorCode status = UErrorCode();