summaryrefslogtreecommitdiff
path: root/ext/soap/php_encoding.c
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-06-11 19:41:43 +0200
committerNikita Popov <nikic@php.net>2015-06-11 23:23:57 +0200
commit5d3cf577aad15b119c137a873f468c0614f2eb2e (patch)
treeabc522e177e51e526c5be4aef6cb42c911ed2cce /ext/soap/php_encoding.c
parent25098f0f5c50249200b1dd80619c782d961287a2 (diff)
downloadphp-git-5d3cf577aad15b119c137a873f468c0614f2eb2e.tar.gz
Make convert_to_* safe with rc>1
This only involves switching zval_dtor to zval_ptr_dtor for arrays and making the convert_to_object for arrays a bit more generic. All the other changes outside zend_operators.c just make use of this new ability (use COPY instead of DUP). What's still missing: Proper references handling. I've seen many convert_to* calls that will break when a reference is used. Also fixes bug #69788.
Diffstat (limited to 'ext/soap/php_encoding.c')
-rw-r--r--ext/soap/php_encoding.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 96207f7975..7bff2aeab6 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -923,21 +923,16 @@ static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNo
if (Z_TYPE_P(data) == IS_STRING) {
str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRLEN_P(data));
- text = xmlNewTextLen(BAD_CAST(str->val), str->len);
- xmlAddChild(ret, text);
- zend_string_release(str);
} else {
- zval tmp;
-
- ZVAL_DUP(&tmp, data);
- convert_to_string(&tmp);
- str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRLEN(tmp));
- text = xmlNewTextLen(BAD_CAST(str->val), str->len);
- xmlAddChild(ret, text);
- zend_string_release(str);
- zval_dtor(&tmp);
+ zend_string *tmp = zval_get_string(data);
+ str = php_base64_encode((unsigned char*) tmp->val, tmp->len);
+ zend_string_release(tmp);
}
+ text = xmlNewTextLen(BAD_CAST(str->val), str->len);
+ xmlAddChild(ret, text);
+ zend_string_release(str);
+
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}