|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38004 Parameters in SoapServer are decoded twice
Submitted: 2006-07-04 12:24 UTC Modified: 2006-07-10 07:23 UTC
From: afalak at poczta dot onet dot pl Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5CVS-2006-07-04 (CVS) OS: Windows 2000
Private report: No CVE-ID: None
 [2006-07-04 12:24 UTC] afalak at poczta dot onet dot pl
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 = new SoapClient('a.wsdl');
$strA = 'test &amp; test';
$strB = 'test & test';
$res = $client->Test(array('strA'=>$strA, 'strB'=>$strB));

function Test($param) {
	file_put_contents('test.txt', $param->strA."\n".$param->strB );
	return 1;
$server = new SoapServer('a.wsdl');

<?xml version="1.0" encoding="UTF-8"?>
		<s:schema elementFormDefault="qualified" targetNamespace="">
			<s:complexType name="Test">
				<s:attribute use="required" name="strA" type="s:string"/>
				<s:attribute use="required" name="strB" type="s:string"/>
			<s:element type="s0:Test" name="Test"/>
			<s:element type="s:int" name="Ret"/>

	<message name="TestSoapIn">
		<part name="parameters" element="s0:Test"/>
	<message name="TestSoapOut">
		<part name="parameters" element="s0:Ret"/>
	<portType name="TestSoap">
		<operation name="Test">
			<input message="s0:TestSoapIn"/>
			<output message="s0:TestSoapOut"/>
	<binding name="TestSoap" type="s0:TestSoap">
		<soap:binding transport="" style="document"/>
		<operation name="Test">
			<soap:operation soapAction="http:/Test/Test" style="document"/>
				<soap:body use="literal"/>
				<soap:body use="literal"/>
	<service name="Test">
		<port name="TestSoapPort" binding="s0:TestSoap">
			<soap:address location="http://localhost/server.php"/>

Expected result:
File text.txt shall contain exactly the same values as calling parameters:

test &amp; test
test & test

Actual result:
The parameters are improperly decoded twice:

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"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-10 07:23 UTC]
Fixed in CVS HEAD and PHP_5_2.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 12:01:29 2024 UTC