xref: /php-src/ext/soap/tests/bugs/bug34453.phpt (revision 8b561d33)
1--TEST--
2Bug #29839 (incorrect convert (xml:lang to lang))
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9
10function EchoString($s) {
11  return $s;
12}
13
14class LocalSoapClient extends SoapClient {
15  private $server;
16
17  function __construct($wsdl, $options) {
18    parent::__construct($wsdl, $options);
19    $this->server = new SoapServer($wsdl, $options);
20    $this->server->addFunction('EchoString');
21  }
22
23  function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
24    ob_start();
25    $this->server->handle($request);
26    $response = ob_get_contents();
27    ob_end_clean();
28    return $response;
29  }
30
31}
32
33$client = new LocalSoapClient(__DIR__."/bug34453.wsdl", array("trace"=>1));
34$client->EchoString(array("value"=>"hello","lang"=>"en"));
35echo $client->__getLastRequest();
36echo $client->__getLastResponse();
37echo "ok\n";
38?>
39--EXPECT--
40<?xml version="1.0" encoding="UTF-8"?>
41<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri"><SOAP-ENV:Body><string xml:lang="en"><ns1:value>hello</ns1:value></string></SOAP-ENV:Body></SOAP-ENV:Envelope>
42<?xml version="1.0" encoding="UTF-8"?>
43<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri"><SOAP-ENV:Body><string xml:lang="en"><ns1:value>hello</ns1:value></string></SOAP-ENV:Body></SOAP-ENV:Envelope>
44ok
45