diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 144851f2e6e..7654c6a3c44 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -296,8 +296,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 00000000000..c5feb173ace
--- /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 00000000000..998fe9fce64
--- /dev/null
+++ b/ext/soap/tests/bugs/bug50675.wsdl
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+