@@ -28,6 +28,7 @@ extern "C" {
28
28
#include " ../intl_convert.h"
29
29
#include " ../locale/locale.h"
30
30
#include < zend_exceptions.h>
31
+ #include < zend_interfaces.h>
31
32
}
32
33
33
34
static zend_class_entry *IntlPartsIterator_ce_ptr;
@@ -229,49 +230,20 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv,
229
230
((zoi_break_iter_parts*)ii->iterator )->key_type = key_type;
230
231
}
231
232
232
- U_CFUNC zend_object *IntlPartsIterator_object_create (zend_class_entry *ce)
233
- {
234
- zend_object *retval = IntlIterator_ce_ptr->create_object (ce);
235
- retval->handlers = &IntlPartsIterator_handlers;
236
-
237
- return retval;
238
- }
239
-
240
- U_CFUNC zend_function *IntlPartsIterator_get_method (zend_object **object_ptr, zend_string *method, const zval *key)
233
+ U_CFUNC PHP_METHOD (IntlPartsIterator, getBreakIterator)
241
234
{
242
- zend_function *ret;
243
- zend_string *lc_method_name;
244
- ALLOCA_FLAG (use_heap);
245
-
246
- if (key == NULL ) {
247
- ZSTR_ALLOCA_ALLOC (lc_method_name, ZSTR_LEN (method), use_heap);
248
- zend_str_tolower_copy (ZSTR_VAL (lc_method_name), ZSTR_VAL (method), ZSTR_LEN (method));
249
- } else {
250
- lc_method_name = Z_STR_P (key);
251
- }
235
+ INTLITERATOR_METHOD_INIT_VARS;
252
236
253
- if (ZSTR_LEN (method) == sizeof (" getrulestatus" ) - 1
254
- && memcmp (" getrulestatus" , ZSTR_VAL (lc_method_name), ZSTR_LEN (lc_method_name)) == 0 ) {
255
- IntlIterator_object *obj = php_intl_iterator_fetch_object (*object_ptr);
256
- if (obj->iterator && !Z_ISUNDEF (obj->iterator ->data )) {
257
- zval *break_iter_zv = &obj->iterator ->data ;
258
- *object_ptr = Z_OBJ_P (break_iter_zv);
259
- ret = Z_OBJ_HANDLER_P (break_iter_zv, get_method)(object_ptr, method, key);
260
- goto end;
261
- }
237
+ if (zend_parse_parameters_none () == FAILURE) {
238
+ RETURN_THROWS ();
262
239
}
263
240
264
- ret = zend_std_get_method (object_ptr, method, key);
265
-
266
- end:
267
- if (key == NULL ) {
268
- ZSTR_ALLOCA_FREE (lc_method_name, use_heap);
269
- }
241
+ INTLITERATOR_METHOD_FETCH_OBJECT;
270
242
271
- return ret ;
243
+ RETURN_COPY_DEREF (&ii-> iterator -> data ) ;
272
244
}
273
245
274
- U_CFUNC PHP_METHOD (IntlPartsIterator, getBreakIterator )
246
+ U_CFUNC PHP_METHOD (IntlPartsIterator, getRuleStatus )
275
247
{
276
248
INTLITERATOR_METHOD_INIT_VARS;
277
249
@@ -281,18 +253,16 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
281
253
282
254
INTLITERATOR_METHOD_FETCH_OBJECT;
283
255
284
- RETURN_COPY_DEREF (&ii->iterator ->data );
256
+ zval *iter = &ii->iterator ->data ;
257
+ ZEND_ASSERT (Z_TYPE_P (iter) == IS_OBJECT);
258
+ zend_call_method_with_0_params (
259
+ Z_OBJ_P (iter), Z_OBJCE_P (iter), NULL , " getrulestatus" , return_value);
285
260
}
286
261
287
262
U_CFUNC void breakiterator_register_IntlPartsIterator_class (void )
288
263
{
289
264
/* Create and register 'BreakIterator' class. */
290
265
IntlPartsIterator_ce_ptr = register_class_IntlPartsIterator (IntlIterator_ce_ptr);
291
- IntlPartsIterator_ce_ptr->create_object = IntlPartsIterator_object_create;
292
-
293
- memcpy (&IntlPartsIterator_handlers, &IntlIterator_handlers,
294
- sizeof IntlPartsIterator_handlers);
295
- IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method;
296
266
297
267
#define PARTSITER_DECL_LONG_CONST (name ) \
298
268
zend_declare_class_constant_long (IntlPartsIterator_ce_ptr, #name, \
0 commit comments