wez Mon Jul 26 21:59:44 2004 EDT
Modified files:
/php-src/ext/com_dotnet com_handlers.c
Log:
Fix #29392 COM behaved badly for non-existant methods
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_handlers.c?r1=1.22&r2=1.23&ty=u
Index: php-src/ext/com_dotnet/com_handlers.c
diff -u php-src/ext/com_dotnet/com_handlers.c:1.22
php-src/ext/com_dotnet/com_handlers.c:1.23
--- php-src/ext/com_dotnet/com_handlers.c:1.22 Tue May 4 11:03:48 2004
+++ php-src/ext/com_dotnet/com_handlers.c Mon Jul 26 21:59:44 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_handlers.c,v 1.22 2004/05/04 15:03:48 wez Exp $ */
+/* $Id: com_handlers.c,v 1.23 2004/07/27 01:59:44 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -307,6 +307,8 @@
f.fn_flags = 0;
f.function_name = estrndup(name, len);
+ fptr = &f;
+
if (obj->typeinfo) {
/* look for byref params */
ITypeComp *comp;
@@ -346,6 +348,11 @@
case DESCKIND_TYPECOMP:
ITypeComp_Release(bindptr.lptcomp);
break;
+
+ case DESCKIND_NONE:
+ default:
+ fptr = NULL;
+ break;
}
if (TI) {
ITypeInfo_Release(TI);
@@ -356,21 +363,27 @@
}
}
- /* 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)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php