Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions ext/spl/spl_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zend_object *objec
ZVAL_UNDEF(&tmp);
offset = &tmp;
}
zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_get, "offsetGet", rv, offset);
zend_call_known_function(intern->fptr_offset_get, object, object->ce, rv, 1, offset, NULL);

if (!Z_ISUNDEF_P(rv)) {
return rv;
Expand Down Expand Up @@ -520,7 +520,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zend_object *objec
spl_hash_key key;

if (check_inherited && intern->fptr_offset_del) {
zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset);
zend_call_known_function(intern->fptr_offset_del, object, object->ce, NULL, 1, offset, NULL);
return;
}

Expand Down Expand Up @@ -575,7 +575,7 @@ static bool spl_array_has_dimension_ex(bool check_inherited, zend_object *object
zval rv, *value = NULL, *tmp;

if (check_inherited && intern->fptr_offset_has) {
zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_has, "offsetExists", &rv, offset);
zend_call_known_function(intern->fptr_offset_has, object, object->ce, &rv, 1, offset, NULL);

if (!zend_is_true(&rv)) {
zval_ptr_dtor(&rv);
Expand Down Expand Up @@ -1130,7 +1130,7 @@ static zend_result spl_array_object_count_elements(zend_object *object, zend_lon

if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv);
zend_call_known_function(intern->fptr_count, object, object->ce, &rv, 0, NULL, NULL);
if (Z_TYPE(rv) != IS_UNDEF) {
*count = zval_get_long(&rv);
zval_ptr_dtor(&rv);
Expand Down Expand Up @@ -1811,18 +1811,11 @@ PHP_METHOD(RecursiveArrayIterator, hasChildren)
}
/* }}} */

static void spl_instantiate_child_arg(zend_class_entry *pce, zval *retval, zval *arg1, zval *arg2) /* {{{ */
{
object_init_ex(retval, pce);
zend_call_known_instance_method_with_2_params(pce->constructor, Z_OBJ_P(retval), NULL, arg1, arg2);
}
/* }}} */

/* {{{ Create a sub iterator for the current element (same class as $this) */
PHP_METHOD(RecursiveArrayIterator, getChildren)
{
zval *object = ZEND_THIS, *entry, flags;
spl_array_object *intern = Z_SPLARRAY_P(object);
zval *entry;
spl_array_object *intern = Z_SPLARRAY_P(ZEND_THIS);
HashTable *aht = spl_array_get_hash_table(intern);

ZEND_PARSE_PARAMETERS_NONE();
Expand All @@ -1845,8 +1838,10 @@ PHP_METHOD(RecursiveArrayIterator, getChildren)
}
}

ZVAL_LONG(&flags, intern->ar_flags);
spl_instantiate_child_arg(Z_OBJCE_P(ZEND_THIS), return_value, entry, &flags);
zval params[2];
ZVAL_COPY_VALUE(&params[0], entry);
ZVAL_LONG(&params[1], intern->ar_flags);
object_init_with_constructor(return_value, Z_OBJCE_P(ZEND_THIS), 2, params, NULL);
}
/* }}} */

Expand Down
4 changes: 2 additions & 2 deletions ext/spl/spl_directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(zend_string *fil

if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
ZVAL_STR(&arg1, file_path);
zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1);
zend_call_known_function(ce->constructor, Z_OBJ_P(return_value), ce, NULL, 1, &arg1, NULL);
} else {
spl_filesystem_info_set_filename(intern, file_path);
}
Expand Down Expand Up @@ -519,7 +519,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int num_args, sp

if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
ZVAL_STR(&arg1, source->file_name);
zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1);
zend_call_known_function(ce->constructor, Z_OBJ_P(return_value), ce, NULL, 1, &arg1, NULL);
} else {
intern->file_name = zend_string_copy(source->file_name);
intern->path = spl_filesystem_object_get_path(source);
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_dllist.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static zend_result spl_dllist_object_count_elements(zend_object *object, zend_lo

if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv);
zend_call_known_function(intern->fptr_count, object, intern->std.ce, &rv, 0, NULL, NULL);
if (!Z_ISUNDEF(rv)) {
*count = zval_get_long(&rv);
zval_ptr_dtor(&rv);
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static zend_result spl_heap_object_count_elements(zend_object *object, zend_long

if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv);
zend_call_known_function(intern->fptr_count, object, intern->std.ce, &rv, 0, NULL, NULL);
if (!Z_ISUNDEF(rv)) {
*count = zval_get_long(&rv);
zval_ptr_dtor(&rv);
Expand Down
19 changes: 9 additions & 10 deletions ext/spl/spl_iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static zend_result spl_recursive_it_valid_ex(spl_recursive_it_object *object, zv
level--;
}
if (object->endIteration && object->in_iteration) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endIteration, "endIteration", NULL);
zend_call_known_function(object->endIteration, Z_OBJ_P(zthis), object->ce, NULL, 0, NULL, NULL);
}
object->in_iteration = false;
return FAILURE;
Expand Down Expand Up @@ -292,7 +292,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv
ZEND_FALLTHROUGH;
case RS_TEST:
if (object->callHasChildren) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callHasChildren, "callHasChildren", &retval);
zend_call_known_function(object->callHasChildren, Z_OBJ_P(zthis), object->ce, &retval, 0, NULL, NULL);
} else {
zend_class_entry *ce = object->iterators[object->level].ce;
zend_object *obj = Z_OBJ(object->iterators[object->level].zobject);
Expand Down Expand Up @@ -333,7 +333,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv
}
}
if (object->nextElement) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL);
zend_call_known_function(object->nextElement, Z_OBJ_P(zthis), object->ce, NULL, 0, NULL, NULL);
}
object->iterators[object->level].state = RS_NEXT;
if (EG(exception)) {
Expand All @@ -346,7 +346,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv
return /* self */;
case RS_SELF:
if (object->nextElement && (object->mode == RIT_SELF_FIRST || object->mode == RIT_CHILD_FIRST)) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL);
zend_call_known_function(object->nextElement, Z_OBJ_P(zthis), object->ce, NULL, 0, NULL, NULL);
}
if (object->mode == RIT_SELF_FIRST) {
object->iterators[object->level].state = RS_CHILD;
Expand All @@ -356,7 +356,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv
return /* self */;
case RS_CHILD:
if (object->callGetChildren) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callGetChildren, "callGetChildren", &child);
zend_call_known_function(object->callGetChildren, Z_OBJ_P(zthis), object->ce, &child, 0, NULL, NULL);
} else {
zend_class_entry *ce = object->iterators[object->level].ce;
zend_object *obj = Z_OBJ(object->iterators[object->level].zobject);
Expand Down Expand Up @@ -408,7 +408,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv
sub_iter->funcs->rewind(sub_iter);
}
if (object->beginChildren) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginChildren, "beginchildren", NULL);
zend_call_known_function(object->beginChildren, Z_OBJ_P(zthis), object->ce, NULL, 0, NULL, NULL);
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
return;
Expand All @@ -422,7 +422,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv
/* no more elements */
if (object->level > 0) {
if (object->endChildren) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL);
zend_call_known_function(object->endChildren, Z_OBJ_P(zthis), object->ce, NULL, 0, NULL, NULL);
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
return;
Expand Down Expand Up @@ -466,7 +466,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
sub_iter->funcs->rewind(sub_iter);
}
if (!EG(exception) && object->beginIteration && !object->in_iteration) {
zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginIteration, "beginIteration", NULL);
zend_call_known_function(object->beginIteration, Z_OBJ_P(zthis), object->ce, NULL, 0, NULL, NULL);
}
object->in_iteration = true;
spl_recursive_it_move_forward_ex(object, zthis);
Expand Down Expand Up @@ -2824,8 +2824,7 @@ PHP_METHOD(AppendIterator, __construct)
}

intern->dit_type = DIT_AppendIterator;
object_init_ex(&intern->u.append.zarrayit, spl_ce_ArrayIterator);
zend_call_method_with_0_params(Z_OBJ(intern->u.append.zarrayit), spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
object_init_with_constructor(&intern->u.append.zarrayit, spl_ce_ArrayIterator, 0, NULL, NULL);
intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0);

} /* }}} */
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static zend_result spl_object_storage_get_hash(zend_hash_key *key, spl_SplObject
ZVAL_OBJ(&param, obj);
ZVAL_UNDEF(&rv);
spl_object_storage_get_hash_depth++;
zend_call_method_with_1_params(&intern->std, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, &param);
zend_call_known_function(intern->fptr_get_hash, &intern->std, intern->std.ce, &rv, 1, &param, NULL);
spl_object_storage_get_hash_depth--;
if (UNEXPECTED(Z_ISUNDEF(rv))) {
/* An exception has occurred */
Expand Down
Loading