ID: 38004 Updated by: [EMAIL PROTECTED] Reported By: afalak at poczta dot onet dot pl Status: Assigned Bug Type: SOAP related Operating System: Windows 2000 PHP Version: 5CVS-2006-07-04 (CVS) Assigned To: dmitry New Comment:
Fixed in CVS HEAD and PHP_5_2. Previous Comments: ------------------------------------------------------------------------ [2006-07-04 12:24:16] afalak at poczta dot onet dot pl Description: ------------ Strings sent as SOAP message parameters change when transported to server functions. This may result in a string cut or even in an encoding error "Encoding: Violation of encoding rules in client.php:" Reproduce code: --------------- [client] <?php $client = new SoapClient('a.wsdl'); $strA = 'test & test'; $strB = 'test & test'; $res = $client->Test(array('strA'=>$strA, 'strB'=>$strB)); ?> [server] <?php function Test($param) { file_put_contents('test.txt', $param->strA."\n".$param->strB ); return 1; } $server = new SoapServer('a.wsdl'); $server->addFunction('Test'); $server->handle(); ?> [a.wsdl] <?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="strA" type="s:string"/> <s:attribute use="required" name="strB" type="s:string"/> </s:complexType> <s:element type="s0:Test" name="Test"/> <s:element type="s:int" 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> Expected result: ---------------- File text.txt shall contain exactly the same values as calling parameters: test & test test & test Actual result: -------------- The parameters are improperly decoded twice: test & test test (note: the second line is cut at "&") Try to change a line in a client to: $strA = 'test &xxx; test'; then you'll get an error "Encoding: Violation of encoding rules in client.php" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38004&edit=1