php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73538 SoapClient::__setSoapHeaders doesn't overwrite SOAP headers
Submitted: 2016-11-16 09:13 UTC Modified: -
From: phpbugs at agares dot info Assigned:
Status: Closed Package: SOAP related
PHP Version: 7.0.13 OS: Windows 10, Ubuntu 16.10
Private report: No CVE-ID:
 [2016-11-16 09:13 UTC] phpbugs at agares dot info
Description:
------------
When I pass an array of headers to __setSoapHeaders, subsequent calls do not overwrite the previous headers. It works correctly when I pass a single object to that method.

Test script:
---------------
<?php
$client = new \SoapClient(null, 
            [
                'trace' => 1,
                'exceptions' => true,
                'uri' => '',
                'location' => '',
            ]);
			
$client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 1])]);
$client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 2])]);

try {
	$client->__soapCall('SomeMethod', ['a' => 'b']);
} catch(\Exception $e) {
}

var_dump($client->__getLastRequest());
var_dump($client->__getLastRequestHeaders());

Expected result:
----------------
Can't post the whole XML because of spam detection, so just a fragment:

><SOAP-ENV:Header><ns2:Header><item><key>something</key><value>1</value></item></ns2:Header></SOAP-ENV:Header>

Actual result:
--------------
><SOAP-ENV:Header><ns2:Header><item><key>something</key><value>2</value></item></ns2:Header></SOAP-ENV:Header>

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-20 20:19 UTC] nikic@php.net
Automatic comment on behalf of git@duncanc.co.uk
Revision: http://git.php.net/?p=php-src.git;a=commit;h=685b1292e9a050ec413662c4b7dcf69030d2010c
Log: Fix bug #73538
 [2016-11-20 20:19 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2016-11-30 23:14 UTC] davey@php.net
Automatic comment on behalf of git@duncanc.co.uk
Revision: http://git.php.net/?p=php-src.git;a=commit;h=685b1292e9a050ec413662c4b7dcf69030d2010c
Log: Fix bug #73538
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Fri Jan 20 01:01:40 2017 UTC