summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_dotnet.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-04-06 10:51:10 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-04-06 10:53:45 +0200
commit9cb32640afb23626920f3e31439310cb83e68550 (patch)
tree61e084007cd750090ac9bfb5e0f87e923843b459 /ext/com_dotnet/com_dotnet.c
parent50765075db6b6d5a9597589601c59f743f6ee9c8 (diff)
downloadphp-git-9cb32640afb23626920f3e31439310cb83e68550.tar.gz
Clean up constructor handling in com_dotnet
We substitute the construction magic with standard constructors, move the ZPP checks to the beginning of the ctors, and also let the function entries be generated from the stubs.
Diffstat (limited to 'ext/com_dotnet/com_dotnet.c')
-rw-r--r--ext/com_dotnet/com_dotnet.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index bee7116fc3..6bd492ef1d 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -179,7 +179,7 @@ out:
}
/* {{{ com_dotnet_create_instance - ctor for DOTNET class */
-PHP_FUNCTION(com_dotnet_create_instance)
+PHP_METHOD(dotnet, __construct)
{
zval *object = getThis();
php_com_dotnet_object *obj;
@@ -195,6 +195,13 @@ PHP_FUNCTION(com_dotnet_create_instance)
zend_long cp = GetACP();
const struct php_win32_cp *cp_it;
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l",
+ &assembly_name, &assembly_name_len,
+ &datatype_name, &datatype_name_len,
+ &cp)) {
+ RETURN_THROWS();
+ }
+
php_com_initialize();
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
if (stuff == NULL) {
@@ -237,13 +244,6 @@ PHP_FUNCTION(com_dotnet_create_instance)
obj = CDNO_FETCH(object);
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l",
- &assembly_name, &assembly_name_len,
- &datatype_name, &datatype_name_len,
- &cp)) {
- RETURN_THROWS();
- }
-
cp_it = php_win32_cp_get_by_id((DWORD)cp);
if (!cp_it) {
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid codepage!");