xref: /PHP-8.3/ext/soap/tests/bugs/bug39832.phpt (revision 7f2f0c00)
1--TEST--
2Bug #39832 (SOAP Server: parameter not matching the WSDL specified type are set to 0)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9$HTTP_RAW_POST_DATA = <<<EOF
10<?xml version="1.0" encoding="UTF-8"?>
11<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test.pl"><SOAP-ENV:Body>
12<SOAP-ENV:Test>
13<parameters priority="high">
14<ns1:NetworkErrorCode>1</ns1:NetworkErrorCode>
15</parameters>
16</SOAP-ENV:Test></SOAP-ENV:Body></SOAP-ENV:Envelope>
17EOF;
18
19function Test($x) {
20  return $x->priority;
21}
22
23$x = new SoapServer(__DIR__."/bug39832.wsdl");
24$x->addFunction("Test");
25$x->handle($HTTP_RAW_POST_DATA);
26?>
27--EXPECT--
28<?xml version="1.0" encoding="UTF-8"?>
29<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>SOAP-ERROR: Encoding: Violation of encoding rules</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
30