@@ -147,24 +147,15 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
147
147
instanceof_function (Z_OBJCE_P (zv_timezone), TimeZone_ce_ptr)) {
148
148
TimeZone_object *to = Z_INTL_TIMEZONE_P (zv_timezone);
149
149
150
- /* TODO Throw proper Error exceptions for uninitialized classes and failure to clone */
151
150
if (to->utimezone == NULL ) {
152
- spprintf (&message, 0 , " %s: passed IntlTimeZone is not "
151
+ zend_throw_error ( NULL , " %s: passed IntlTimeZone is not "
153
152
" properly constructed" , func);
154
- if (message) {
155
- intl_errors_set (outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1 );
156
- efree (message);
157
- }
158
153
zval_ptr_dtor_str (&local_zv_tz);
159
154
return NULL ;
160
155
}
161
156
timeZone = to->utimezone ->clone ();
162
157
if (UNEXPECTED (timeZone == NULL )) {
163
- spprintf (&message, 0 , " %s: could not clone TimeZone" , func);
164
- if (message) {
165
- intl_errors_set (outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1 );
166
- efree (message);
167
- }
158
+ zend_throw_error (NULL , " %s: could not clone TimeZone" , func);
168
159
zval_ptr_dtor_str (&local_zv_tz);
169
160
return NULL ;
170
161
}
@@ -185,32 +176,20 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
185
176
}
186
177
if (intl_stringFromChar (id, Z_STRVAL_P (zv_timezone), Z_STRLEN_P (zv_timezone),
187
178
&status) == FAILURE) {
188
- spprintf (&message, 0 , " %s: Time zone identifier given is not a "
179
+ zend_throw_error ( NULL , " %s: Time zone identifier given is not a "
189
180
" valid UTF-8 string" , func);
190
- if (message) {
191
- intl_errors_set (outside_error, status, message, 1 );
192
- efree (message);
193
- }
194
181
zval_ptr_dtor_str (&local_zv_tz);
195
182
return NULL ;
196
183
}
197
184
timeZone = TimeZone::createTimeZone (id);
198
185
if (UNEXPECTED (timeZone == NULL )) {
199
- spprintf (&message, 0 , " %s: Could not create time zone" , func);
200
- if (message) {
201
- intl_errors_set (outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1 );
202
- efree (message);
203
- }
186
+ zend_throw_error (NULL , " %s: Could not create time zone" , func);
204
187
zval_ptr_dtor_str (&local_zv_tz);
205
188
return NULL ;
206
189
}
207
190
if (*timeZone == TimeZone::getUnknown ()) {
208
- spprintf (&message, 0 , " %s: No such time zone: '%s'" ,
191
+ zend_throw_error ( NULL , " %s: No such time zone: '%s'" ,
209
192
func, Z_STRVAL_P (zv_timezone));
210
- if (message) {
211
- intl_errors_set (outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1 );
212
- efree (message);
213
- }
214
193
zval_ptr_dtor_str (&local_zv_tz);
215
194
delete timeZone;
216
195
return NULL ;
0 commit comments