Fixed bug #38067 (Parameters are not decoded from utf-8 when using encoding option)

This commit is contained in:
Dmitry Stogov 2006-07-12 09:00:15 +00:00
parent 4fb0776b8e
commit 6a12b2de74
3 changed files with 92 additions and 4 deletions

View File

@ -1349,12 +1349,12 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e
str_val = (*attr)->def;
}
if (str_val) {
zval zstr;
xmlNodePtr dummy;
xmlNodePtr dummy, text;
zval *data;
ZVAL_STRING(&zstr, str_val, 0);
dummy = master_to_xml(get_conversion(IS_STRING), &zstr, SOAP_LITERAL, NULL);
dummy = xmlNewNode(NULL, BAD_CAST("BOGUS"));
text = xmlNewText(BAD_CAST(str_val));
xmlAddChild(dummy, text);
data = master_to_zval((*attr)->encode, dummy);
xmlFreeNode(dummy);
set_zval_property(ret, (*attr)->name, data TSRMLS_CC);

View File

@ -0,0 +1,40 @@
--TEST--
Bug #38067 (Parameters are not decoded from utf-8 when using encoding option)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function Test($param) {
global $g;
$g = $param->str;
return $g;
}
class TestSoapClient extends SoapClient {
function __construct($wsdl, $opt) {
parent::__construct($wsdl, $opt);
$this->server = new SoapServer($wsdl, $opt);
$this->server->addFunction('Test');
}
function __doRequest($request, $location, $action, $version) {
ob_start();
$this->server->handle($request);
$response = ob_get_contents();
ob_end_clean();
return $response;
}
}
$client = new TestSoapClient(dirname(__FILE__).'/bug38067.wsdl',
array('encoding' => 'ISO-8859-1'));
$str = 'test: Ä';
$res = $client->Test(array('str'=>$str));
echo $str."\n";
echo $res."\n";
echo $g."\n";
?>
--EXPECT--
test: Ä
test: Ä
test: Ä

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://test.pl"
targetNamespace="http://test.pl"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://test.pl">
<s:complexType name="Test">
<s:attribute use="required" name="str" type="s:string"/>
</s:complexType>
<s:element type="s0:Test" name="Test"/>
<s:element type="s:string" name="Ret"/>
</s:schema>
</types>
<message name="TestSoapIn">
<part name="parameters" element="s0:Test"/>
</message>
<message name="TestSoapOut">
<part name="parameters" element="s0:Ret"/>
</message>
<portType name="TestSoap">
<operation name="Test">
<input message="s0:TestSoapIn"/>
<output message="s0:TestSoapOut"/>
</operation>
</portType>
<binding name="TestSoap" type="s0:TestSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="Test">
<soap:operation soapAction="http:/Test/Test" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="Test">
<port name="TestSoapPort" binding="s0:TestSoap">
<soap:address location="http://localhost/server.php"/>
</port>
</service>
</definitions>