summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Brown <abrown@php.net>2001-08-14 03:52:32 +0000
committerAlan Brown <abrown@php.net>2001-08-14 03:52:32 +0000
commit292d27bf6a5667fc741afcb8938dc0cee00688a8 (patch)
treeacc57c705dd995f008df3b8dd6831d56c9083f04
parent5e21a4afad96e7f4d99cd3c7743f76a6c3d0655f (diff)
downloadphp-git-292d27bf6a5667fc741afcb8938dc0cee00688a8.tar.gz
Whenever typelibrary constants were loaded, there was a GP Fault at process exit as shutdown_memory_manager seemed to delete constants that were supposed to have been deleted earlier. It seems as though CONST_PERSISTENT is a bad thing to use. Resetting that bit on the constant creation still seems to work and the GP Fault at exit is gone.
-rw-r--r--ext/com/COM.c19
-rw-r--r--ext/rpc/com/com_wrapper.c19
2 files changed, 18 insertions, 20 deletions
diff --git a/ext/com/COM.c b/ext/com/COM.c
index 3b455c1e9c..acb4a54eec 100644
--- a/ext/com/COM.c
+++ b/ext/com/COM.c
@@ -413,7 +413,7 @@ static PHP_INI_MH(OnTypelibFileChange)
ITypeLib *pTL;
char *typelib_name;
char *modifier, *ptr;
- int mode = CONST_PERSISTENT|CONST_CS;
+ int mode = CONST_CS;
if(typelib_name_buffer[0]==';')
{
@@ -490,7 +490,7 @@ PHP_FUNCTION(com_load)
comval *obj;
char *error_message;
char *clsid_str;
- int mode = CONST_PERSISTENT;
+ int mode = 0; /* CONST_PERSISTENT; */
ITypeLib *pTL;
@@ -747,7 +747,6 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
return FAILURE;
}
}
-
/* return a single element if next() was called without count */
if((arg_count == 0) && (count == 1))
{
@@ -1216,7 +1215,7 @@ PHP_FUNCTION(com_load_typelib)
{
case 1:
getParameters(ht, 1, &arg_typelib);
- mode = CONST_PERSISTENT|CONST_CS;
+ mode = CONST_CS; /* CONST_PERSISTENT|CONST_CS; */
break;
case 2:
getParameters(ht, 2, &arg_typelib, &arg_cis);
@@ -1758,10 +1757,12 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
j++;
continue;
}
- ids = php_OLECHAR_to_char(bstr_ids, NULL, 1, codepage TSRMLS_CC);
+ ids = php_OLECHAR_to_char(bstr_ids, NULL, TRUE, codepage TSRMLS_CC);
SysFreeString(bstr_ids);
c.name_len = strlen(ids)+1;
c.name = ids;
+
+ /* Before registering the contsnt, let's see if we can find it */
if (zend_get_constant(c.name, c.name_len-1, &exists TSRMLS_CC))
{
/* Oops, it already exists. No problem if it is defined as the same value */
@@ -1775,13 +1776,11 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
continue;
}
- php_variant_to_pval(pVarDesc->lpvarValue, &c.value, FALSE, codepage TSRMLS_CC);
+ php_variant_to_pval(pVarDesc->lpvarValue, &c.value, mode & CONST_PERSISTENT, codepage TSRMLS_CC);
c.flags = mode;
- /* Before registering the contsnt, let's see if we can find it */
- {
- zend_register_constant(&c TSRMLS_CC);
- }
+ zend_register_constant(&c TSRMLS_CC);
+
j++;
}
TypeInfo->lpVtbl->Release(TypeInfo);
diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c
index 3b455c1e9c..acb4a54eec 100644
--- a/ext/rpc/com/com_wrapper.c
+++ b/ext/rpc/com/com_wrapper.c
@@ -413,7 +413,7 @@ static PHP_INI_MH(OnTypelibFileChange)
ITypeLib *pTL;
char *typelib_name;
char *modifier, *ptr;
- int mode = CONST_PERSISTENT|CONST_CS;
+ int mode = CONST_CS;
if(typelib_name_buffer[0]==';')
{
@@ -490,7 +490,7 @@ PHP_FUNCTION(com_load)
comval *obj;
char *error_message;
char *clsid_str;
- int mode = CONST_PERSISTENT;
+ int mode = 0; /* CONST_PERSISTENT; */
ITypeLib *pTL;
@@ -747,7 +747,6 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
return FAILURE;
}
}
-
/* return a single element if next() was called without count */
if((arg_count == 0) && (count == 1))
{
@@ -1216,7 +1215,7 @@ PHP_FUNCTION(com_load_typelib)
{
case 1:
getParameters(ht, 1, &arg_typelib);
- mode = CONST_PERSISTENT|CONST_CS;
+ mode = CONST_CS; /* CONST_PERSISTENT|CONST_CS; */
break;
case 2:
getParameters(ht, 2, &arg_typelib, &arg_cis);
@@ -1758,10 +1757,12 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
j++;
continue;
}
- ids = php_OLECHAR_to_char(bstr_ids, NULL, 1, codepage TSRMLS_CC);
+ ids = php_OLECHAR_to_char(bstr_ids, NULL, TRUE, codepage TSRMLS_CC);
SysFreeString(bstr_ids);
c.name_len = strlen(ids)+1;
c.name = ids;
+
+ /* Before registering the contsnt, let's see if we can find it */
if (zend_get_constant(c.name, c.name_len-1, &exists TSRMLS_CC))
{
/* Oops, it already exists. No problem if it is defined as the same value */
@@ -1775,13 +1776,11 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
continue;
}
- php_variant_to_pval(pVarDesc->lpvarValue, &c.value, FALSE, codepage TSRMLS_CC);
+ php_variant_to_pval(pVarDesc->lpvarValue, &c.value, mode & CONST_PERSISTENT, codepage TSRMLS_CC);
c.flags = mode;
- /* Before registering the contsnt, let's see if we can find it */
- {
- zend_register_constant(&c TSRMLS_CC);
- }
+ zend_register_constant(&c TSRMLS_CC);
+
j++;
}
TypeInfo->lpVtbl->Release(TypeInfo);