bug73538.phpt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. SOAP: SoapClient::__setHeaders array overrides previous headers
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. $client = new SoapClient(null, [
  8. "location" => "test://",
  9. "uri" => "test://",
  10. "exceptions" => false,
  11. "trace" => true,
  12. ]);
  13. $client->__setSoapHeaders(new \SoapHeader('ns', 'Header', ['something' => 1]));
  14. $client->__setSoapHeaders(new \SoapHeader('ns', 'Header', ['something' => 2]));
  15. $client->test();
  16. echo $client->__getLastRequest();
  17. $client = new SoapClient(null, [
  18. "location" => "test://",
  19. "uri" => "test://",
  20. "exceptions" => false,
  21. "trace" => true,
  22. ]);
  23. $client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 1])]);
  24. $client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 2])]);
  25. $client->test();
  26. echo $client->__getLastRequest();
  27. ?>
  28. --EXPECT--
  29. <?xml version="1.0" encoding="UTF-8"?>
  30. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="test://" xmlns:ns2="ns" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header><ns2:Header><item><key>something</key><value>2</value></item></ns2:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns1:test/></SOAP-ENV:Body></SOAP-ENV:Envelope>
  31. <?xml version="1.0" encoding="UTF-8"?>
  32. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="test://" xmlns:ns2="ns" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header><ns2:Header><item><key>something</key><value>2</value></item></ns2:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns1:test/></SOAP-ENV:Body></SOAP-ENV:Envelope>