From 8d30d5f26944f98ef370cc09a638461510e9ad2b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 25 Feb 2020 12:31:51 +0100 Subject: [PATCH] Add stubs for COMPersistHelper --- ext/com_dotnet/com_persist.c | 50 +++++++++++++++++----------- ext/com_dotnet/com_persist.stub.php | 21 ++++++++++++ ext/com_dotnet/com_persist_arginfo.h | 30 +++++++++++++++++ 3 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 ext/com_dotnet/com_persist.stub.php create mode 100644 ext/com_dotnet/com_persist_arginfo.h diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 656215dd1a..f9eb36f105 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -29,6 +29,7 @@ #include "php_com_dotnet.h" #include "php_com_dotnet_internal.h" #include "Zend/zend_exceptions.h" +#include "com_persist_arginfo.h" /* {{{ expose php_stream as a COM IStream */ @@ -336,6 +337,10 @@ CPH_METHOD(GetCurFileName) OLECHAR *olename = NULL; CPH_FETCH(); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + CPH_NO_OBJ(); res = get_persist_file(helper); @@ -374,15 +379,15 @@ CPH_METHOD(SaveToFile) OLECHAR *olefilename = NULL; CPH_FETCH(); + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p!|b", + &filename, &filename_len, &remember)) { + RETURN_THROWS(); + } + CPH_NO_OBJ(); res = get_persist_file(helper); if (helper->ipf) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p!|b", - &filename, &filename_len, &remember)) { - RETURN_THROWS(); - } - if (filename) { fullpath = expand_filepath(filename, NULL); if (!fullpath) { @@ -436,16 +441,15 @@ CPH_METHOD(LoadFromFile) OLECHAR *olefilename; CPH_FETCH(); + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", + &filename, &filename_len, &flags)) { + RETURN_THROWS(); + } + CPH_NO_OBJ(); res = get_persist_file(helper); if (helper->ipf) { - - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", - &filename, &filename_len, &flags)) { - RETURN_THROWS(); - } - if (!(fullpath = expand_filepath(filename, NULL))) { RETURN_FALSE; } @@ -479,6 +483,10 @@ CPH_METHOD(GetMaxStreamSize) ULARGE_INTEGER size; CPH_FETCH(); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + CPH_NO_OBJ(); res = get_persist_stream_init(helper); @@ -510,6 +518,10 @@ CPH_METHOD(InitNew) HRESULT res; CPH_FETCH(); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + CPH_NO_OBJ(); res = get_persist_stream_init(helper); @@ -671,14 +683,14 @@ CPH_METHOD(__construct) static const zend_function_entry com_persist_helper_methods[] = { - CPH_ME(__construct, NULL) - CPH_ME(GetCurFileName, NULL) - CPH_ME(SaveToFile, NULL) - CPH_ME(LoadFromFile, NULL) - CPH_ME(GetMaxStreamSize, NULL) - CPH_ME(InitNew, NULL) - CPH_ME(LoadFromStream, NULL) - CPH_ME(SaveToStream, NULL) + CPH_ME(__construct, arginfo_class_COMPersistHelper___construct) + CPH_ME(GetCurFileName, arginfo_class_COMPersistHelper_GetCurFileName) + CPH_ME(SaveToFile, arginfo_class_COMPersistHelper_SaveToFile) + CPH_ME(LoadFromFile, arginfo_class_COMPersistHelper_LoadFromFile) + CPH_ME(GetMaxStreamSize, arginfo_class_COMPersistHelper_GetMaxStreamSize) + CPH_ME(InitNew, arginfo_class_COMPersistHelper_InitNew) + CPH_ME(LoadFromStream, arginfo_class_COMPersistHelper_LoadFromStream) + CPH_ME(SaveToStream, arginfo_class_COMPersistHelper_SaveToStream) PHP_FE_END }; diff --git a/ext/com_dotnet/com_persist.stub.php b/ext/com_dotnet/com_persist.stub.php new file mode 100644 index 0000000000..5f183b175a --- /dev/null +++ b/ext/com_dotnet/com_persist.stub.php @@ -0,0 +1,21 @@ +