diff options
| -rw-r--r-- | Zend/zend_interfaces.c | 3 | ||||
| -rw-r--r-- | ext/spl/spl_iterators.c | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 6d35e7159c..3009af2b3f 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -89,7 +89,8 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z /* {{{ zend_user_it_new_iterator */ ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *retval) { - zend_call_method_with_0_params(Z_OBJ_P(object), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", retval); + zend_call_known_instance_method_with_0_params( + ce->iterator_funcs_ptr->zf_new_iterator, Z_OBJ_P(object), retval); } /* }}} */ diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 8ddd413cf3..99e130e5d2 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -487,7 +487,9 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling); if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) { - zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval); + zend_function **getiterator_cache = Z_OBJCE_P(iterator)->iterator_funcs_ptr + ? &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator : NULL; + zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), getiterator_cache, "getiterator", &aggregate_retval); iterator = &aggregate_retval; } else { Z_ADDREF_P(iterator); @@ -510,7 +512,9 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling); if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) { - zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval); + zend_function **getiterator_cache = Z_OBJCE_P(iterator)->iterator_funcs_ptr + ? &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator : NULL; + zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), getiterator_cache, "getiterator", &aggregate_retval); iterator = &aggregate_retval; } else { Z_ADDREF_P(iterator); @@ -1362,7 +1366,9 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z ce = ce_cast; } if (instanceof_function(ce, zend_ce_aggregate)) { - zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval); + zend_function **getiterator_cache = + ce->iterator_funcs_ptr ? &ce->iterator_funcs_ptr->zf_new_iterator : NULL; + zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, getiterator_cache, "getiterator", &retval); if (EG(exception)) { zval_ptr_dtor(&retval); return NULL; |
