- Avoid using malloc()

- Improve and fix leaks in the typelib constants registration mechanism
This commit is contained in:
Zeev Suraski 2001-08-14 12:47:09 +00:00
parent 0fbbadbd2f
commit eb52f75407
8 changed files with 72 additions and 60 deletions

View File

@ -132,13 +132,14 @@ PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DIS
switch (hr) {
case DISP_E_EXCEPTION: {
int srclen;
char *src = php_OLECHAR_to_char(ExceptInfo.bstrSource, &srclen, 1, codepage TSRMLS_CC);
char *src = php_OLECHAR_to_char(ExceptInfo.bstrSource, &srclen, codepage TSRMLS_CC);
int desclen;
char *desc = php_OLECHAR_to_char(ExceptInfo.bstrDescription, &desclen, 1, codepage TSRMLS_CC);
char *desc = php_OLECHAR_to_char(ExceptInfo.bstrDescription, &desclen, codepage TSRMLS_CC);
*ErrString = pemalloc(srclen+desclen+50, 1);
sprintf(*ErrString, "<b>Source</b>: %s <b>Description</b>: %s", src, desc);
pefree(src, 1);
pefree(desc, 1);
efree(src);
efree(desc);
SysFreeString(ExceptInfo.bstrSource);
SysFreeString(ExceptInfo.bstrDescription);
SysFreeString(ExceptInfo.bstrHelpFile);
@ -329,7 +330,7 @@ static char *php_string_from_clsid(const CLSID *clsid TSRMLS_DC)
char *clsid_str;
StringFromCLSID(clsid, &ole_clsid);
clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, 0, codepage TSRMLS_CC);
clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, codepage TSRMLS_CC);
LocalFree(ole_clsid);
return clsid_str;
@ -379,7 +380,7 @@ static PHP_INI_MH(OnTypelibFileChange)
ITypeLib *pTL;
char *typelib_name;
char *modifier, *ptr;
int mode = CONST_CS;
int mode = CONST_CS | CONST_PERSISTENT;
if (typelib_name_buffer[0]==';') {
continue;
@ -801,7 +802,7 @@ PHP_FUNCTION(com_invoke)
RETURN_FALSE;
}
php_variant_to_pval(var_result, return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
FREE_VARIANT(var_result);
efree(arguments);
@ -1001,7 +1002,7 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result, &ErrString TSRMLS_CC);
if (SUCCEEDED(hr)) {
php_variant_to_pval(var_result, return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
} else {
*return_value = *value;
zval_copy_ctor(return_value);
@ -1046,7 +1047,7 @@ PHP_FUNCTION(com_propget)
RETURN_FALSE;
}
php_variant_to_pval(var_result, return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
FREE_VARIANT(var_result);
}
@ -1187,7 +1188,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
obj = obj_prop;
php_COM_set(obj, &V_DISPATCH(var_result), TRUE TSRMLS_CC);
} else {
php_variant_to_pval(var_result, &return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, &return_value, codepage TSRMLS_CC);
FREE_COM(obj_prop);
obj_prop = NULL;
@ -1348,7 +1349,7 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
if (do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count TSRMLS_CC) == FAILURE) {
RETVAL_FALSE;
} else {
php_variant_to_pval(var_result, return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
}
FREE_VARIANT(var_result);
@ -1553,7 +1554,7 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
char *EnumId;
TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, 0, codepage);
EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, codepage);
printf("Enumeration %d - %s:\n", i, EnumId);
efree(EnumId);
#endif
@ -1563,19 +1564,20 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
j=0;
while(SUCCEEDED(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc))) {
BSTR bstr_ids;
char *ids;
zend_constant c;
zval exists, results;
char *const_name;
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
if (NameCount!=1) {
j++;
continue;
}
ids = php_OLECHAR_to_char(bstr_ids, NULL, TRUE, codepage TSRMLS_CC);
const_name = php_OLECHAR_to_char(bstr_ids, &c.name_len, codepage TSRMLS_CC);
c.name = zend_strndup(const_name, c.name_len);
efree(const_name);
c.name_len++; /* length should include the NULL */
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)) {
@ -1584,12 +1586,16 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
if (!compare_function(&results, &c.value, &exists TSRMLS_CC) && INI_INT("com.autoregister_verbose")) {
php_error(E_WARNING,"Type library value %s is already defined and has a different value", c.name);
}
free(ids);
free(c.name);
j++;
continue;
}
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, mode & CONST_PERSISTENT, codepage TSRMLS_CC);
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, codepage TSRMLS_CC);
if (mode & CONST_PERSISTENT) {
zval_persist(&c.value TSRMLS_CC);
mode |= CONST_EFREE_PERSISTENT;
}
c.flags = mode;
zend_register_constant(&c TSRMLS_CC);

View File

@ -205,7 +205,7 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r
case OE_IS_OBJECT:
if (!strcmp(overloaded_property->element.value.str.val, "value")) {
php_variant_to_pval(var_arg, &result, 0, codepage TSRMLS_CC);
php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC);
} else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) {
ZVAL_LONG(&result, V_VT(var_arg))
} else {

View File

@ -424,7 +424,7 @@ static void pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, int type, int c
}
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage TSRMLS_DC)
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TSRMLS_DC)
{
/* Changed the function to return a value for recursive error testing */
/* Existing calls will be unaffected by the change - so it */
@ -494,7 +494,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
/* If SafeArrayGetElement proclaims to allocate */
/* memory for a BSTR, so the recursive call frees */
/* the string correctly */
if (FAILURE == php_variant_to_pval(&vv, element, persistent, codepage TSRMLS_CC)) {
if (FAILURE == php_variant_to_pval(&vv, element, codepage TSRMLS_CC)) {
/* Error occurred setting up array element */
/* Error was displayed by the recursive call */
FREE_ZVAL(element);
@ -562,7 +562,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
OLECHAR *unicode_str;
switch (VarBstrFromDec(&V_DECIMAL(var_arg), LOCALE_SYSTEM_DEFAULT, 0, &unicode_str)) {
case S_OK:
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(pval_arg), persistent, codepage TSRMLS_CC);
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
Z_TYPE_P(pval_arg) = IS_STRING;
break;
@ -599,15 +599,15 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
break;
case VT_VARIANT:
php_variant_to_pval(V_VARIANTREF(var_arg), pval_arg, persistent, codepage TSRMLS_CC);
php_variant_to_pval(V_VARIANTREF(var_arg), pval_arg, codepage TSRMLS_CC);
break;
case VT_BSTR:
if (V_ISBYREF(var_arg)) {
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage TSRMLS_CC);
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
efree(V_BSTRREF(var_arg));
} else {
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage TSRMLS_CC);
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
}
Z_TYPE_P(pval_arg) = IS_STRING;
@ -752,7 +752,7 @@ PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage TSRML
}
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage TSRMLS_DC)
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage TSRMLS_DC)
{
char *C_str;
uint length = 0;
@ -761,12 +761,12 @@ PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int per
uint reqSize = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, NULL, 0, NULL, NULL);
if (reqSize) {
C_str = (char *) pemalloc(sizeof(char) * reqSize, persistent);
C_str = (char *) emalloc(sizeof(char) * reqSize);
/* convert string */
length = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, C_str, reqSize, NULL, NULL) - 1;
} else {
C_str = (char *) pemalloc(sizeof(char), persistent);
C_str = (char *) emalloc(sizeof(char));
*C_str = 0;
php_error(E_WARNING,"Error in php_OLECHAR_to_char()");

View File

@ -5,9 +5,9 @@ BEGIN_EXTERN_C()
PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage TSRMLS_DC);
PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage TSRMLS_DC);
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage TSRMLS_DC);
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TSRMLS_DC);
PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage TSRMLS_DC);
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage TSRMLS_DC);
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage TSRMLS_DC);
END_EXTERN_C()

View File

@ -132,13 +132,14 @@ PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DIS
switch (hr) {
case DISP_E_EXCEPTION: {
int srclen;
char *src = php_OLECHAR_to_char(ExceptInfo.bstrSource, &srclen, 1, codepage TSRMLS_CC);
char *src = php_OLECHAR_to_char(ExceptInfo.bstrSource, &srclen, codepage TSRMLS_CC);
int desclen;
char *desc = php_OLECHAR_to_char(ExceptInfo.bstrDescription, &desclen, 1, codepage TSRMLS_CC);
char *desc = php_OLECHAR_to_char(ExceptInfo.bstrDescription, &desclen, codepage TSRMLS_CC);
*ErrString = pemalloc(srclen+desclen+50, 1);
sprintf(*ErrString, "<b>Source</b>: %s <b>Description</b>: %s", src, desc);
pefree(src, 1);
pefree(desc, 1);
efree(src);
efree(desc);
SysFreeString(ExceptInfo.bstrSource);
SysFreeString(ExceptInfo.bstrDescription);
SysFreeString(ExceptInfo.bstrHelpFile);
@ -329,7 +330,7 @@ static char *php_string_from_clsid(const CLSID *clsid TSRMLS_DC)
char *clsid_str;
StringFromCLSID(clsid, &ole_clsid);
clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, 0, codepage TSRMLS_CC);
clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, codepage TSRMLS_CC);
LocalFree(ole_clsid);
return clsid_str;
@ -379,7 +380,7 @@ static PHP_INI_MH(OnTypelibFileChange)
ITypeLib *pTL;
char *typelib_name;
char *modifier, *ptr;
int mode = CONST_CS;
int mode = CONST_CS | CONST_PERSISTENT;
if (typelib_name_buffer[0]==';') {
continue;
@ -801,7 +802,7 @@ PHP_FUNCTION(com_invoke)
RETURN_FALSE;
}
php_variant_to_pval(var_result, return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
FREE_VARIANT(var_result);
efree(arguments);
@ -1001,7 +1002,7 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result, &ErrString TSRMLS_CC);
if (SUCCEEDED(hr)) {
php_variant_to_pval(var_result, return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
} else {
*return_value = *value;
zval_copy_ctor(return_value);
@ -1046,7 +1047,7 @@ PHP_FUNCTION(com_propget)
RETURN_FALSE;
}
php_variant_to_pval(var_result, return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
FREE_VARIANT(var_result);
}
@ -1187,7 +1188,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
obj = obj_prop;
php_COM_set(obj, &V_DISPATCH(var_result), TRUE TSRMLS_CC);
} else {
php_variant_to_pval(var_result, &return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, &return_value, codepage TSRMLS_CC);
FREE_COM(obj_prop);
obj_prop = NULL;
@ -1348,7 +1349,7 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
if (do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count TSRMLS_CC) == FAILURE) {
RETVAL_FALSE;
} else {
php_variant_to_pval(var_result, return_value, FALSE, codepage TSRMLS_CC);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
}
FREE_VARIANT(var_result);
@ -1553,7 +1554,7 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
char *EnumId;
TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, 0, codepage);
EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, codepage);
printf("Enumeration %d - %s:\n", i, EnumId);
efree(EnumId);
#endif
@ -1563,19 +1564,20 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
j=0;
while(SUCCEEDED(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc))) {
BSTR bstr_ids;
char *ids;
zend_constant c;
zval exists, results;
char *const_name;
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
if (NameCount!=1) {
j++;
continue;
}
ids = php_OLECHAR_to_char(bstr_ids, NULL, TRUE, codepage TSRMLS_CC);
const_name = php_OLECHAR_to_char(bstr_ids, &c.name_len, codepage TSRMLS_CC);
c.name = zend_strndup(const_name, c.name_len);
efree(const_name);
c.name_len++; /* length should include the NULL */
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)) {
@ -1584,12 +1586,16 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
if (!compare_function(&results, &c.value, &exists TSRMLS_CC) && INI_INT("com.autoregister_verbose")) {
php_error(E_WARNING,"Type library value %s is already defined and has a different value", c.name);
}
free(ids);
free(c.name);
j++;
continue;
}
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, mode & CONST_PERSISTENT, codepage TSRMLS_CC);
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, codepage TSRMLS_CC);
if (mode & CONST_PERSISTENT) {
zval_persist(&c.value TSRMLS_CC);
mode |= CONST_EFREE_PERSISTENT;
}
c.flags = mode;
zend_register_constant(&c TSRMLS_CC);

View File

@ -424,7 +424,7 @@ static void pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, int type, int c
}
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage TSRMLS_DC)
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TSRMLS_DC)
{
/* Changed the function to return a value for recursive error testing */
/* Existing calls will be unaffected by the change - so it */
@ -494,7 +494,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
/* If SafeArrayGetElement proclaims to allocate */
/* memory for a BSTR, so the recursive call frees */
/* the string correctly */
if (FAILURE == php_variant_to_pval(&vv, element, persistent, codepage TSRMLS_CC)) {
if (FAILURE == php_variant_to_pval(&vv, element, codepage TSRMLS_CC)) {
/* Error occurred setting up array element */
/* Error was displayed by the recursive call */
FREE_ZVAL(element);
@ -562,7 +562,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
OLECHAR *unicode_str;
switch (VarBstrFromDec(&V_DECIMAL(var_arg), LOCALE_SYSTEM_DEFAULT, 0, &unicode_str)) {
case S_OK:
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(pval_arg), persistent, codepage TSRMLS_CC);
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
Z_TYPE_P(pval_arg) = IS_STRING;
break;
@ -599,15 +599,15 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
break;
case VT_VARIANT:
php_variant_to_pval(V_VARIANTREF(var_arg), pval_arg, persistent, codepage TSRMLS_CC);
php_variant_to_pval(V_VARIANTREF(var_arg), pval_arg, codepage TSRMLS_CC);
break;
case VT_BSTR:
if (V_ISBYREF(var_arg)) {
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage TSRMLS_CC);
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
efree(V_BSTRREF(var_arg));
} else {
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage TSRMLS_CC);
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
}
Z_TYPE_P(pval_arg) = IS_STRING;
@ -752,7 +752,7 @@ PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage TSRML
}
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage TSRMLS_DC)
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage TSRMLS_DC)
{
char *C_str;
uint length = 0;
@ -761,12 +761,12 @@ PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int per
uint reqSize = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, NULL, 0, NULL, NULL);
if (reqSize) {
C_str = (char *) pemalloc(sizeof(char) * reqSize, persistent);
C_str = (char *) emalloc(sizeof(char) * reqSize);
/* convert string */
length = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, C_str, reqSize, NULL, NULL) - 1;
} else {
C_str = (char *) pemalloc(sizeof(char), persistent);
C_str = (char *) emalloc(sizeof(char));
*C_str = 0;
php_error(E_WARNING,"Error in php_OLECHAR_to_char()");

View File

@ -5,9 +5,9 @@ BEGIN_EXTERN_C()
PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage TSRMLS_DC);
PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage TSRMLS_DC);
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage TSRMLS_DC);
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TSRMLS_DC);
PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage TSRMLS_DC);
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage TSRMLS_DC);
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage TSRMLS_DC);
END_EXTERN_C()

View File

@ -205,7 +205,7 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r
case OE_IS_OBJECT:
if (!strcmp(overloaded_property->element.value.str.val, "value")) {
php_variant_to_pval(var_arg, &result, 0, codepage TSRMLS_CC);
php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC);
} else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) {
ZVAL_LONG(&result, V_VT(var_arg))
} else {