@@ -107,6 +107,7 @@ static void _php_intlgregcal_constructor_body(
107
107
108
108
gcal = new GregorianCalendar (tz, Locale::createFromName (locale),
109
109
status);
110
+ // Should this throw?
110
111
if (U_FAILURE (status)) {
111
112
intl_error_set (NULL , status, " intlgregcal_create_instance: error "
112
113
" creating ICU GregorianCalendar from time zone and locale" , 0 );
@@ -124,14 +125,9 @@ static void _php_intlgregcal_constructor_body(
124
125
// From date/time (3, 5 or 6 arguments)
125
126
for (int i = 0 ; i < variant; i++) {
126
127
if (largs[i] < INT32_MIN || largs[i] > INT32_MAX) {
127
- intl_error_set (NULL , U_ILLEGAL_ARGUMENT_ERROR,
128
- " intlgregcal_create_instance: at least one of the arguments"
129
- " has an absolute value that is too large" , 0 );
130
- if (!is_constructor) {
131
- zval_ptr_dtor (return_value);
132
- RETVAL_NULL ();
133
- }
134
- return ;
128
+ zend_argument_value_error (getThis () ? (i-1 ):i,
129
+ " must be between %d and %d" , INT32_MIN, INT32_MAX);
130
+ RETURN_THROWS ();
135
131
}
136
132
}
137
133
@@ -244,9 +240,8 @@ U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year)
244
240
}
245
241
246
242
if (year < INT32_MIN || year > INT32_MAX) {
247
- intl_error_set (NULL , U_ILLEGAL_ARGUMENT_ERROR,
248
- " intlgregcal_is_leap_year: year out of bounds" , 0 );
249
- RETURN_FALSE;
243
+ zend_argument_value_error (getThis () ? 1 :2 , " must be between %d and %d" , INT32_MIN, INT32_MAX);
244
+ RETURN_THROWS ();
250
245
}
251
246
252
247
CALENDAR_METHOD_FETCH_OBJECT;
0 commit comments