summaryrefslogtreecommitdiff
path: root/ext/com_dotnet
diff options
context:
space:
mode:
Diffstat (limited to 'ext/com_dotnet')
-rw-r--r--ext/com_dotnet/com_extension.c2
-rw-r--r--ext/com_dotnet/com_handlers.c11
-rw-r--r--ext/com_dotnet/com_iterator.c6
-rw-r--r--ext/com_dotnet/com_saproxy.c8
-rw-r--r--ext/com_dotnet/php_com_dotnet_internal.h4
5 files changed, 15 insertions, 16 deletions
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index f6f7ab44c0..93ef530394 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.c
@@ -192,7 +192,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU);
INIT_CLASS_ENTRY(ce, "com_exception", NULL);
- php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
+ php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
/* php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index 052d9919ea..a710ada588 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -486,17 +486,12 @@ static int com_objects_compare(zval *object1, zval *object2 TSRMLS_DC)
return ret;
}
-static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
+static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
{
php_com_dotnet_object *obj;
VARIANT v;
VARTYPE vt = VT_EMPTY;
- zval free_obj;
HRESULT res = S_OK;
-
- if (should_free) {
- free_obj = *writeobj;
- }
obj = CDNO_FETCH(readobj);
ZVAL_NULL(writeobj);
@@ -538,10 +533,6 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f
VariantClear(&v);
- if (should_free) {
- zval_dtor(&free_obj);
- }
-
if (SUCCEEDED(res)) {
return SUCCESS;
}
diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c
index 66dbfb4267..2527dacea2 100644
--- a/ext/com_dotnet/com_iterator.c
+++ b/ext/com_dotnet/com_iterator.c
@@ -139,7 +139,7 @@ static zend_object_iterator_funcs com_iter_funcs = {
NULL
};
-zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS_DC)
+zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
{
php_com_dotnet_object *obj;
struct php_com_iterator *I;
@@ -149,6 +149,10 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
unsigned long n_fetched;
zval *ptr;
+ if (by_ref) {
+ zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
+ }
+
obj = CDNO_FETCH(object);
if (V_VT(&obj->v) != VT_DISPATCH && !V_ISARRAY(&obj->v)) {
diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c
index 9077c7bc12..8cc0c5e64b 100644
--- a/ext/com_dotnet/com_saproxy.c
+++ b/ext/com_dotnet/com_saproxy.c
@@ -357,7 +357,7 @@ static int saproxy_objects_compare(zval *object1, zval *object2 TSRMLS_DC)
return -1;
}
-static int saproxy_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
+static int saproxy_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
{
return FAILURE;
}
@@ -554,12 +554,16 @@ static zend_object_iterator_funcs saproxy_iter_funcs = {
};
-zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object TSRMLS_DC)
+zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
{
php_com_saproxy *proxy = SA_FETCH(object);
php_com_saproxy_iter *I;
int i;
+ if (by_ref) {
+ zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
+ }
+
I = ecalloc(1, sizeof(*I));
I->iter.funcs = &saproxy_iter_funcs;
I->iter.data = I;
diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h
index 4c442389f6..2cd0c2b960 100644
--- a/ext/com_dotnet/php_com_dotnet_internal.h
+++ b/ext/com_dotnet/php_com_dotnet_internal.h
@@ -82,7 +82,7 @@ zend_object_handlers php_com_object_handlers;
void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable TSRMLS_DC);
/* com_saproxy.c */
-zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object TSRMLS_DC);
+zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index TSRMLS_DC);
/* com_olechar.c */
@@ -177,7 +177,7 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, int codepage TSRMLS_DC);
/* com_iterator.c */
-zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS_DC);
+zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
#endif