From db47e35373513705b84b7391ed25e9854308eef2 Mon Sep 17 00:00:00 2001 From: Cameron Porter Date: Sat, 6 Oct 2018 01:09:22 -0500 Subject: [PATCH] Fixed bug #50675 SOAP: Stop overwriting the node name when creating an XML node for an object reference. --- NEWS | 3 + ext/soap/php_encoding.c | 2 - ext/soap/tests/bugs/bug50675.phpt | 50 +++++++++++++++++ ext/soap/tests/bugs/bug50675.wsdl | 93 +++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 ext/soap/tests/bugs/bug50675.phpt create mode 100644 ext/soap/tests/bugs/bug50675.wsdl diff --git a/NEWS b/NEWS index bf1e53ff73..4aea171c1f 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2018, PHP 7.2.13 +- SOAP: + . Fixed bug #50675 (SoapClient can't handle object references correctly). + (Cameron Porter) 08 Nov 2018, PHP 7.2.12 diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 2da75a3e2e..6051995713 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -298,8 +298,6 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node) { if (node_ptr == node) { return 0; } - xmlNodeSetName(node, node_ptr->name); - xmlSetNs(node, node_ptr->ns); if (SOAP_GLOBAL(soap_version) == SOAP_1_1) { while (1) { attr = get_attribute(attr, "id"); diff --git a/ext/soap/tests/bugs/bug50675.phpt b/ext/soap/tests/bugs/bug50675.phpt new file mode 100644 index 0000000000..c5feb173ac --- /dev/null +++ b/ext/soap/tests/bugs/bug50675.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #50675 SoapClient can't handle object references correctly. +--SKIPIF-- + +--FILE-- + + + + + soapenv:Server.userException + service.EchoServiceException + + + 105 + string param + + steckovic + + + + +EOF; + } +} + +ini_set('soap.wsdl_cache_enabled', 0); + +$parameters = [ + 'trace' => 1, + 'exceptions' => 0, +]; +$client = new TestSoapClient(dirname(__FILE__) . '/bug50675.wsdl', $parameters); + +$person = new stdClass(); +$person->name = 'name'; + +$result = $client->echoPerson($person, $person); + +print($client->__getLastRequest()); +--EXPECT-- + +

name

diff --git a/ext/soap/tests/bugs/bug50675.wsdl b/ext/soap/tests/bugs/bug50675.wsdl new file mode 100644 index 0000000000..998fe9fce6 --- /dev/null +++ b/ext/soap/tests/bugs/bug50675.wsdl @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.40.0