Don't throw manual exceptions on ZPP failure

As of PHP 8.0.0, ZPP throws on failure, so manually throwing exceptions
is superfluous and confusing.
This commit is contained in:
Christoph M. Becker 2019-08-11 22:20:26 +02:00
parent 177981d80d
commit 3e80b13682
4 changed files with 1 additions and 11 deletions

View file

@ -60,12 +60,10 @@ PHP_FUNCTION(com_create_instance)
ZEND_NUM_ARGS(), "s|s!ls",
&module_name, &module_name_len, &server_name, &server_name_len,
&cp, &typelib_name, &typelib_name_len) &&
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
FAILURE == zend_parse_parameters(
ZEND_NUM_ARGS(), "sa|ls",
&module_name, &module_name_len, &server_params, &cp,
&typelib_name, &typelib_name_len)) {
php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid arguments!");
return;
}
@ -302,7 +300,6 @@ PHP_FUNCTION(com_get_active_object)
php_com_initialize();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
&module_name, &module_name_len, &code_page)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments!");
return;
}

View file

@ -243,7 +243,6 @@ PHP_FUNCTION(com_dotnet_create_instance)
&assembly_name, &assembly_name_len,
&datatype_name, &datatype_name_len,
&cp)) {
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid arguments!");
return;
}

View file

@ -382,7 +382,6 @@ CPH_METHOD(SaveToFile)
if (helper->ipf) {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p!|b",
&filename, &filename_len, &remember)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
return;
}
@ -446,7 +445,6 @@ CPH_METHOD(LoadFromFile)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|l",
&filename, &filename_len, &flags)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
return;
}
@ -542,7 +540,6 @@ CPH_METHOD(LoadFromStream)
CPH_FETCH();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) {
php_com_throw_exception(E_INVALIDARG, "invalid arguments");
return;
}
@ -604,7 +601,6 @@ CPH_METHOD(SaveToStream)
CPH_NO_OBJ();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) {
php_com_throw_exception(E_INVALIDARG, "invalid arguments");
return;
}
@ -652,7 +648,6 @@ CPH_METHOD(__construct)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!",
&zobj, php_com_variant_class_entry)) {
php_com_throw_exception(E_INVALIDARG, "invalid arguments");
return;
}

View file

@ -452,7 +452,6 @@ PHP_FUNCTION(com_variant_create_instance)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
"z!|ll", &zvalue, &vt, &codepage)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
return;
}