diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
| commit | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (patch) | |
| tree | b38e2e5c6974b9a15f103e5cf884cba9fff90ef4 /ext/com_dotnet | |
| parent | a88a88d0986a4a32288c102cdbfebd78d7e91d99 (diff) | |
| download | php-upstream/5.2.0.tar.gz | |
Imported Upstream version 5.2.0upstream/5.2.0
Diffstat (limited to 'ext/com_dotnet')
| -rw-r--r-- | ext/com_dotnet/com_com.c | 4 | ||||
| -rw-r--r-- | ext/com_dotnet/com_extension.c | 23 | ||||
| -rw-r--r-- | ext/com_dotnet/com_handlers.c | 15 | ||||
| -rw-r--r-- | ext/com_dotnet/com_iterator.c | 8 | ||||
| -rwxr-xr-x | ext/com_dotnet/com_persist.c | 21 | ||||
| -rw-r--r-- | ext/com_dotnet/com_saproxy.c | 10 | ||||
| -rw-r--r-- | ext/com_dotnet/com_typeinfo.c | 4 | ||||
| -rw-r--r-- | ext/com_dotnet/php_com_dotnet_internal.h | 6 |
8 files changed, 48 insertions, 43 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 7d3dd5834..b48cd2ff7 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: com_com.c,v 1.16.2.2 2006/01/26 11:17:34 rrichards Exp $ */ +/* $Id: com_com.c,v 1.16.2.2.2.1 2006/10/10 17:32:50 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -340,7 +340,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member, { HRESULT hr; unsigned int arg_err; - EXCEPINFO e; + EXCEPINFO e = {0}; hr = IDispatch_Invoke(V_DISPATCH(&obj->v), id_member, &IID_NULL, LOCALE_SYSTEM_DEFAULT, flags, disp_params, v, &e, &arg_err); diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 6e8a82803..c043d53f9 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: com_extension.c,v 1.17.2.2 2006/01/01 12:50:00 sniper Exp $ */ +/* $Id: com_extension.c,v 1.17.2.2.2.4 2006/10/18 23:47:33 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -30,6 +30,8 @@ #include "Zend/zend_exceptions.h" ZEND_DECLARE_MODULE_GLOBALS(com_dotnet) +static PHP_GINIT_FUNCTION(com_dotnet); + TsHashTable php_com_typelibraries; zend_class_entry @@ -86,7 +88,11 @@ zend_module_entry com_dotnet_module_entry = { PHP_RSHUTDOWN(com_dotnet), PHP_MINFO(com_dotnet), "0.1", - STANDARD_MODULE_PROPERTIES + PHP_MODULE_GLOBALS(com_dotnet), + PHP_GINIT(com_dotnet), + NULL, + NULL, + STANDARD_MODULE_PROPERTIES_EX }; /* }}} */ @@ -109,7 +115,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate) char *strtok_buf = NULL; int cached; - if (!new_value || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) { + if (!new_value || !new_value[0] || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) { return FAILURE; } @@ -170,9 +176,9 @@ PHP_INI_BEGIN() PHP_INI_END() /* }}} */ -/* {{{ php_com_dotnet_init_globals +/* {{{ PHP_GINIT_FUNCTION */ -static void php_com_dotnet_init_globals(zend_com_dotnet_globals *com_dotnet_globals) +static PHP_GINIT_FUNCTION(com_dotnet) { memset(com_dotnet_globals, 0, sizeof(*com_dotnet_globals)); com_dotnet_globals->code_page = CP_ACP; @@ -185,14 +191,11 @@ PHP_MINIT_FUNCTION(com_dotnet) { zend_class_entry ce, *tmp; - ZEND_INIT_MODULE_GLOBALS(com_dotnet, php_com_dotnet_init_globals, NULL); - REGISTER_INI_ENTRIES(); - php_com_wrapper_minit(INIT_FUNC_ARGS_PASSTHRU); 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; */ @@ -221,6 +224,8 @@ PHP_MINIT_FUNCTION(com_dotnet) tmp->get_iterator = php_com_iter_get; #endif + REGISTER_INI_ENTRIES(); + #define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT) COM_CONST(CLSCTX_INPROC_SERVER); diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 911fc73a9..1815af9dc 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: com_handlers.c,v 1.30.2.5 2006/02/07 11:50:54 rrichards Exp $ */ +/* $Id: com_handlers.c,v 1.30.2.5.2.2 2006/10/06 12:23:30 edink Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -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,15 +533,11 @@ 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; } - return FAILURE; + return zend_std_cast_object_tostring(readobj, writeobj, type TSRMLS_CC); } static int com_object_count(zval *object, long *count TSRMLS_DC) diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c index 27afaa621..8756b4f4d 100644 --- a/ext/com_dotnet/com_iterator.c +++ b/ext/com_dotnet/com_iterator.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: com_iterator.c,v 1.9.2.2 2006/02/07 11:50:54 rrichards Exp $ */ +/* $Id: com_iterator.c,v 1.9.2.2.2.1 2006/05/10 14:39:10 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -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_persist.c b/ext/com_dotnet/com_persist.c index b59d2ebb4..e53b86c23 100755 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: com_persist.c,v 1.5.2.3 2006/03/29 14:28:41 tony2001 Exp $ */ +/* $Id: com_persist.c,v 1.5.2.3.2.1 2006/09/16 18:10:32 iliaa Exp $ */ /* Infrastructure for working with persistent COM objects. * Implements: IStream* wrapper for PHP streams. @@ -390,15 +390,16 @@ CPH_METHOD(SaveToFile) if (filename) { fullpath = expand_filepath(filename, NULL TSRMLS_CC); - - if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { + if (!fullpath) { RETURN_FALSE; } - - if (php_check_open_basedir(fullpath TSRMLS_CC)) { + + if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || + php_check_open_basedir(fullpath TSRMLS_CC)) { + efree(fullpath); RETURN_FALSE; } - + olefilename = php_com_string_to_olestring(filename, strlen(fullpath), helper->codepage TSRMLS_CC); efree(fullpath); } @@ -452,13 +453,13 @@ CPH_METHOD(LoadFromFile) return; } - fullpath = expand_filepath(filename, NULL TSRMLS_CC); - - if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { + if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { RETURN_FALSE; } - if (php_check_open_basedir(fullpath TSRMLS_CC)) { + if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || + php_check_open_basedir(fullpath TSRMLS_CC)) { + efree(fullpath); RETURN_FALSE; } diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index 3c7568a91..a985be0fc 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: com_saproxy.c,v 1.15.2.2 2006/01/01 12:50:00 sniper Exp $ */ +/* $Id: com_saproxy.c,v 1.15.2.2.2.1 2006/05/10 14:39:10 rrichards Exp $ */ /* This module implements a SafeArray proxy which is used internally * by the engine when resolving multi-dimensional array accesses on @@ -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/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index eb4a20ca0..a62e32df2 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: com_typeinfo.c,v 1.7.2.1 2006/01/01 12:50:00 sniper Exp $ */ +/* $Id: com_typeinfo.c,v 1.7.2.1.2.1 2006/08/25 12:01:57 edink Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -220,7 +220,7 @@ PHPAPI int php_com_import_typelib(ITypeLib *TL, int mode, int codepage TSRMLS_DC /* Type-library stuff */ void php_com_typelibrary_dtor(void *pDest) { - ITypeLib *Lib = *(ITypeLib**)pDest; + ITypeLib *Lib = (ITypeLib*)pDest; ITypeLib_Release(Lib); } diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h index 2f4fcf173..b63ecb2b9 100644 --- a/ext/com_dotnet/php_com_dotnet_internal.h +++ b/ext/com_dotnet/php_com_dotnet_internal.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_com_dotnet_internal.h,v 1.14.2.3 2006/01/26 11:17:34 rrichards Exp $ */ +/* $Id: php_com_dotnet_internal.h,v 1.14.2.3.2.1 2006/05/10 14:39:10 rrichards Exp $ */ #ifndef PHP_COM_DOTNET_INTERNAL_H #define 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 |
