Skip to content

Commit 47252a1

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
2 parents ce4869f + 685b129 commit 47252a1

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ PHP NEWS
2929
- PCRE:
3030
. Fixed bug #73483 (Segmentation fault on pcre_replace_callback). (Laruence)
3131

32+
- Soap:
33+
. Fixed bug #73538 (SoapClient::__setSoapHeaders doesn't overwrite SOAP
34+
headers). (duncan3dc)
35+
3236
- SQLite3:
3337
. Update to SQLite 3.15.1. (cmb)
3438
. Fixed bug #73530 (Unsetting result set may reset other result set). (cmb)

ext/soap/soap.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,12 +3207,8 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
32073207
if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) {
32083208
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1);
32093209
} else if (Z_TYPE_P(headers) == IS_ARRAY) {
3210-
zval *default_headers;
3211-
32123210
verify_soap_headers_array(Z_ARRVAL_P(headers));
3213-
if ((default_headers = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1)) == NULL) {
3214-
add_property_zval(this_ptr, "__default_headers", headers);
3215-
}
3211+
add_property_zval(this_ptr, "__default_headers", headers);
32163212
} else if (Z_TYPE_P(headers) == IS_OBJECT &&
32173213
instanceof_function(Z_OBJCE_P(headers), soap_header_class_entry)) {
32183214
zval default_headers;

ext/soap/tests/bugs/bug73538.phpt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--TEST--
2+
SOAP: SoapClient::__setHeaders array overrides previous headers
3+
--SKIPIF--
4+
<?php require_once('skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
8+
$client = new SoapClient(null, [
9+
"location" => "test://",
10+
"uri" => "test://",
11+
"exceptions" => false,
12+
"trace" => true,
13+
]);
14+
$client->__setSoapHeaders(new \SoapHeader('ns', 'Header', ['something' => 1]));
15+
$client->__setSoapHeaders(new \SoapHeader('ns', 'Header', ['something' => 2]));
16+
$client->test();
17+
echo $client->__getLastRequest();
18+
19+
$client = new SoapClient(null, [
20+
"location" => "test://",
21+
"uri" => "test://",
22+
"exceptions" => false,
23+
"trace" => true,
24+
]);
25+
$client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 1])]);
26+
$client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 2])]);
27+
$client->test();
28+
echo $client->__getLastRequest();
29+
30+
?>
31+
--EXPECT--
32+
<?xml version="1.0" encoding="UTF-8"?>
33+
<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>
34+
<?xml version="1.0" encoding="UTF-8"?>
35+
<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>

0 commit comments

Comments
 (0)