f.fn_flags = 0;
f.function_name = estrndup(name, len);
+ fptr = &f;
+
if (obj->typeinfo) {
/* look for byref params */
ITypeComp *comp;
case DESCKIND_TYPECOMP:
ITypeComp_Release(bindptr.lptcomp);
break;
+
+ case DESCKIND_NONE:
+ default:
+ fptr = NULL;
+ break;
}
if (TI) {
ITypeInfo_Release(TI);
}
}
- /* save this method in the cache */
- if (!obj->method_cache) {
- ALLOC_HASHTABLE(obj->method_cache);
- zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
- }
+ if (fptr) {
+ /* save this method in the cache */
+ if (!obj->method_cache) {
+ ALLOC_HASHTABLE(obj->method_cache);
+ zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
+ }
- zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), (void**)&fptr);
+ zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), (void**)&fptr);
+ }
}
- /* duplicate this into a new chunk of emalloc'd memory,
- * since the engine will efree it */
- func = emalloc(sizeof(*fptr));
- memcpy(func, fptr, sizeof(*fptr));
+ if (fptr) {
+ /* duplicate this into a new chunk of emalloc'd memory,
+ * since the engine will efree it */
+ func = emalloc(sizeof(*fptr));
+ memcpy(func, fptr, sizeof(*fptr));
+
+ return func;
+ }
- return func;
+ return NULL;
}
static int com_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)