diff options
author | Nikita Popov <nikic@php.net> | 2016-11-20 21:19:34 +0100 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2016-11-20 21:19:34 +0100 |
commit | 42449d431f835d13bad4eb5b245c9d0dc577b279 (patch) | |
tree | 3c5913c4d7e79a0bf36f4891bdb2f7fea82299a5 | |
parent | 617dcf1b37ed43bba35e5f720383addb8ae7c562 (diff) | |
parent | 47252a1e7489718c8c9db3b92b78df2e2e116936 (diff) | |
download | php-git-42449d431f835d13bad4eb5b245c9d0dc577b279.tar.gz |
Merge branch 'PHP-7.1'
-rw-r--r-- | ext/soap/soap.c | 6 | ||||
-rw-r--r-- | ext/soap/tests/bugs/bug73538.phpt | 35 |
2 files changed, 36 insertions, 5 deletions
diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 52b4dcbef4..48733def55 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -3207,12 +3207,8 @@ PHP_METHOD(SoapClient, __setSoapHeaders) if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) { zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1); } else if (Z_TYPE_P(headers) == IS_ARRAY) { - zval *default_headers; - verify_soap_headers_array(Z_ARRVAL_P(headers)); - if ((default_headers = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1)) == NULL) { - add_property_zval(this_ptr, "__default_headers", headers); - } + add_property_zval(this_ptr, "__default_headers", headers); } else if (Z_TYPE_P(headers) == IS_OBJECT && instanceof_function(Z_OBJCE_P(headers), soap_header_class_entry)) { zval default_headers; diff --git a/ext/soap/tests/bugs/bug73538.phpt b/ext/soap/tests/bugs/bug73538.phpt new file mode 100644 index 0000000000..1bf0372419 --- /dev/null +++ b/ext/soap/tests/bugs/bug73538.phpt @@ -0,0 +1,35 @@ +--TEST-- +SOAP: SoapClient::__setHeaders array overrides previous headers +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$client = new SoapClient(null, [ + "location" => "test://", + "uri" => "test://", + "exceptions" => false, + "trace" => true, +]); +$client->__setSoapHeaders(new \SoapHeader('ns', 'Header', ['something' => 1])); +$client->__setSoapHeaders(new \SoapHeader('ns', 'Header', ['something' => 2])); +$client->test(); +echo $client->__getLastRequest(); + +$client = new SoapClient(null, [ + "location" => "test://", + "uri" => "test://", + "exceptions" => false, + "trace" => true, +]); +$client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 1])]); +$client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 2])]); +$client->test(); +echo $client->__getLastRequest(); + +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<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> +<?xml version="1.0" encoding="UTF-8"?> +<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> |