Skip to content

Commit a1ab7bb

Browse files
committed
Simplify user_stream_create_object
1 parent b3e51b7 commit a1ab7bb

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

main/streams/userspace.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -298,28 +298,8 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php
298298
}
299299

300300
if (uwrap->ce->constructor) {
301-
zend_fcall_info fci;
302-
zend_fcall_info_cache fcc;
303-
zval retval;
304-
305-
fci.size = sizeof(fci);
306-
ZVAL_UNDEF(&fci.function_name);
307-
fci.object = Z_OBJ_P(object);
308-
fci.retval = &retval;
309-
fci.param_count = 0;
310-
fci.params = NULL;
311-
312-
fcc.function_handler = uwrap->ce->constructor;
313-
fcc.called_scope = Z_OBJCE_P(object);
314-
fcc.object = Z_OBJ_P(object);
315-
316-
if (zend_call_function(&fci, &fcc) == FAILURE) {
317-
php_error_docref(NULL, E_WARNING, "Could not execute %s::%s()", ZSTR_VAL(uwrap->ce->name), ZSTR_VAL(uwrap->ce->constructor->common.function_name));
318-
zval_ptr_dtor(object);
319-
ZVAL_UNDEF(object);
320-
} else {
321-
zval_ptr_dtor(&retval);
322-
}
301+
zend_call_known_instance_method_with_0_params(
302+
uwrap->ce->constructor, Z_OBJ_P(object), NULL);
323303
}
324304
}
325305

0 commit comments

Comments
 (0)