summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_variant.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-04-29 13:46:03 +0200
committerAnatol Belski <ab@php.net>2014-04-29 13:46:03 +0200
commit3fbacdc6e87383b0e0765850398aaae6547c5216 (patch)
tree8cc8dd1fec46faaba0a7cd62ed6d0099eca4fbe9 /ext/com_dotnet/com_variant.c
parentb22f33afe225b5c5530927acc32ba7588adbf960 (diff)
parent2d625b5f81205d7f0217243b0bfe9a77683951e8 (diff)
downloadphp-git-3fbacdc6e87383b0e0765850398aaae6547c5216.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fixed bug #66431 Special Character via COM Interface (CP_UTF8)
Diffstat (limited to 'ext/com_dotnet/com_variant.c')
-rw-r--r--ext/com_dotnet/com_variant.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c
index 4e044b20b8..7f691de325 100644
--- a/ext/com_dotnet/com_variant.c
+++ b/ext/com_dotnet/com_variant.c
@@ -154,7 +154,11 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
case IS_STRING:
V_VT(v) = VT_BSTR;
olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC);
- V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR));
+ if (CP_UTF8 == codepage) {
+ V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR));
+ } else {
+ V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR));
+ }
efree(olestring);
break;