From: chammers at netcologne dot de
Operating system: Linux
PHP version: 5.2.6
PHP Bug Type: SOAP related
Bug description: SoapServer does not report WSDL validation errors
Description:
------------
When receiving a SOAP request, SoapServer does not properly validate if it
matches the given WSDL.
Invalid elements are simply surpressed and not passed through to the
called function.
I would expect the SoapServer->handler() to raise an Exception so that the
program can decide if it terminates or go ahead with all parameters it can
get.
bye,
-christian-
Reproduce code:
---------------
<?php
ini_set("soap.wsdl_cache_enabled", "0");
class DummyClass {
public function __call($name, $arguments) {
fprintf(STDERR, "Method $name was called with
".var_export($arguments, 1)."\n");
}
}
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://www.foo.de/services/exampleService">
<SOAP-ENV:Body>
<ns1:exampleRequest>
<aaaa>1000</aaaa>
<bbb>815</bbb>
</ns1:exampleRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
$server = new SoapServer("chammers.wsdl");
$server->setClass('DummyClass');
$server->handle($HTTP_RAW_POST_DATA);
########################################################################
And the WSDL (here "chammers.wsdl")
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="http://www.foo.de/services/exampleService"
targetNamespace="http://www.foo.de/services/exampleService">
<!-- ==== TYPES ==== -->
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.foo.de/services/exampleService">
<xsd:element name="exampleRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="aaa" type="xsd:int"/>
<xsd:element name="bbb" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<!-- ==== MESSAGE ==== -->
<wsdl:message name="exampleRequestMessage">
<wsdl:part name="body" element="tns:exampleRequest"/>
</wsdl:message>
<!-- ==== PORTTYPE ==== -->
<wsdl:portType name="examplePortType">
<wsdl:operation name="example">
<wsdl:input message="tns:exampleRequestMessage"/>
</wsdl:operation>
</wsdl:portType>
<!-- ==== BINDING ==== -->
<wsdl:binding name="exampleBinding" type="tns:examplePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="example">
<soap:operation
soapAction="http://soap.foo.de/services/example"/>
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<!-- ==== SERVICE ==== -->
<wsdl:service name="exampleServices">
<wsdl:port name="examplePortType" binding="tns:exampleBinding">
<soap:address
location="http://localhost:4080/services/exampleServices"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Expected result:
----------------
As the request parameter "aaa" has a typo and is actually written as
"aaaa" I would expect an Exception or at least some kind of warning.
Actual result:
--------------
... but the handler class just gets the "bbb" parameter:
$ php chammers.php
Method example was called with array (
0 =>
stdClass::__set_state(array(
'bbb' => 815,
)),
)
--
Edit bug report at http://bugs.php.net/?id=45966&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45966&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45966&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45966&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45966&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45966&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45966&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45966&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45966&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45966&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45966&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45966&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45966&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45966&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45966&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45966&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45966&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45966&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45966&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45966&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45966&r=mysqlcfg