Skip to content

Commit

Permalink
Simplify user_stream_create_object
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jul 23, 2020
1 parent b3e51b7 commit a1ab7bb
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions main/streams/userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,28 +298,8 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php
}

if (uwrap->ce->constructor) {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
zval retval;

fci.size = sizeof(fci);
ZVAL_UNDEF(&fci.function_name);
fci.object = Z_OBJ_P(object);
fci.retval = &retval;
fci.param_count = 0;
fci.params = NULL;

fcc.function_handler = uwrap->ce->constructor;
fcc.called_scope = Z_OBJCE_P(object);
fcc.object = Z_OBJ_P(object);

if (zend_call_function(&fci, &fcc) == FAILURE) {
php_error_docref(NULL, E_WARNING, "Could not execute %s::%s()", ZSTR_VAL(uwrap->ce->name), ZSTR_VAL(uwrap->ce->constructor->common.function_name));
zval_ptr_dtor(object);
ZVAL_UNDEF(object);
} else {
zval_ptr_dtor(&retval);
}
zend_call_known_instance_method_with_0_params(
uwrap->ce->constructor, Z_OBJ_P(object), NULL);
}
}

Expand Down

0 comments on commit a1ab7bb

Please sign in to comment.