summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2004-07-27 22:17:00 +0000
committerWez Furlong <wez@php.net>2004-07-27 22:17:00 +0000
commitaa74430ee084283d32b081d589b857bb3e98ab17 (patch)
treee360a602ab4aa112c60b31d796cb710d2a80923b
parent4897bbe125b04ede62121e001a7a66409c2b6288 (diff)
downloadphp-git-aa74430ee084283d32b081d589b857bb3e98ab17.tar.gz
"better" "fix" for #29392.
This fixes the crash; the sample script: $c = new COM('ADODB.Connection'); echo $c; still does not work because the engine tries to call $c->__toString() and the ADODB object *might* implement that method, but doesn't know until you open the connection.
-rw-r--r--ext/com_dotnet/com_handlers.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index d18a5a952c..cee0b41017 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -286,11 +286,19 @@ static void function_dtor(void *pDest)
}
}
+static PHP_FUNCTION(com_method_handler)
+{
+ Z_OBJ_HANDLER_P(getThis(), call_method)(
+ ((zend_internal_function*)EG(function_state_ptr)->function)->function_name,
+ INTERNAL_FUNCTION_PARAM_PASSTHRU);
+}
+
static union _zend_function *com_method_get(zval *object, char *name, int len TSRMLS_DC)
{
zend_internal_function f, *fptr = NULL;
php_com_dotnet_object *obj;
union _zend_function *func;
+ DISPID dummy;
obj = CDNO_FETCH(object);
@@ -298,6 +306,10 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
return NULL;
}
+ if (FAILED(php_com_get_id_of_name(obj, name, len, &dummy TSRMLS_CC))) {
+ return NULL;
+ }
+
/* check cache */
if (obj->method_cache == NULL || FAILURE == zend_hash_find(obj->method_cache, name, len, (void**)&fptr)) {
f.type = ZEND_OVERLOADED_FUNCTION;
@@ -306,6 +318,7 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
f.scope = obj->ce;
f.fn_flags = 0;
f.function_name = estrndup(name, len);
+ f.handler = PHP_FN(com_method_handler);
fptr = &f;
@@ -350,8 +363,6 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
break;
case DESCKIND_NONE:
- //default:
- // fptr = NULL;
break;
}
if (TI) {