bug31755.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Bug #31755 (Cannot create SOAP header in no namespace)
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. class MySoapClient extends SoapClient {
  8. public function __doRequest($request, $location, $action, $version, $one_way = 0): string {
  9. echo $request, "\n";
  10. return '';
  11. }
  12. }
  13. $client = new MySoapClient(null, array(
  14. 'location' => 'http://localhost', 'uri' => 'myNS', 'exceptions' => false
  15. ));
  16. try {
  17. new SOAPHeader('', 'foo', 'bar');
  18. } catch (ValueError $exception) {
  19. echo $exception->getMessage() . "\n";
  20. }
  21. $header = new SOAPHeader('namespace', 'foo', 'bar');
  22. $response= $client->__soapCall('function', array(), null, $header);
  23. print $client->__getLastRequest();
  24. ?>
  25. --EXPECT--
  26. SoapHeader::__construct(): Argument #1 ($namespace) cannot be empty
  27. <?xml version="1.0" encoding="UTF-8"?>
  28. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="myNS" xmlns:ns2="namespace" 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:foo>bar</ns2:foo></SOAP-ENV:Header><SOAP-ENV:Body><ns1:function/></SOAP-ENV:Body></SOAP-ENV:Envelope>