From 3e80b136825516481f388ee41cf4716dff945ae3 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 11 Aug 2019 22:20:26 +0200 Subject: [PATCH] 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. --- ext/com_dotnet/com_com.c | 5 +---- ext/com_dotnet/com_dotnet.c | 1 - ext/com_dotnet/com_persist.c | 5 ----- ext/com_dotnet/com_variant.c | 1 - 4 files changed, 1 insertion(+), 11 deletions(-) diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 15465d4956..a16d5396d8 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -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; } diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index 7222615986..2904076f12 100644 --- a/ext/com_dotnet/com_dotnet.c +++ b/ext/com_dotnet/com_dotnet.c @@ -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; } diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 97810ec8cc..03b5dd09c8 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -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; } diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index aef7fabe7f..64a14666fc 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -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; } -- 2.40.0