Bug #73237 [Com]: Nested object in "any" element overwrites other fields
| From: | fgs dot inacio at gmail dot com | Date: | Wed, 05 Oct 2016 02:25:50 +0000 |
| Subject: | Bug #73237 [Com]: Nested object in "any" element overwrites other fields | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-204461@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73237&edit=1
ID: 73237
Comment by: fgs dot inacio at gmail dot com
Reported by: ksmiley at salesforce dot com
Summary: Nested object in "any" element overwrites other
fields
Status: Open
Type: Bug
Package: SOAP related
Operating System: Any
PHP Version: 7.0.11
Block user comment: N
Private report: N
New Comment:
I have a problem that can be similar.
PHP version 5.6 SOAP communication was occurring correctly, but when upgrading to version 7.0.11,
the operation became incorrect.
Below the section of code that runs on PHP 5 but does not work in php 7.
protected function zSendSOAP($urlService, $dataArray, $operaration) {
ini_set("soap.wsdl_cache_enabled", "0");
$options = array(
'location' => $urlService,
'uri' => 'http://schemas.xmlsoap.org/soap/envelope/',
'local_cert' => $this->certKEY,
'soap_version' => SOAP_1_2,
'cache_wsdl' => WSDL_CACHE_NONE,
'connection_timeout' => 15,
'encoding' => 'UTF-8',
'trace' => 1,
'exceptions' => 1
);
$urlWsdl = $urlService . '?wsdl';
$soap = new SoapClient($urlWsdl, $options);
$obterOperacaoTransportePdf = array(
'ObterOperacaoTransportePdfRequest' => array(
'Integrador' => '761ba43d-dc74-4900-85bf-70853fcae4a9',
'Versao' => '1',
'CodigoIdentificacaoOperacao' => '161000003705/1660',
'DocumentoViagem' => ''
)
);
$data = $soap->$operaration($obterOperacaoTransportePdf);
return $data;
}
On the server that receives the data, the key "Integrator" is not being received, and
possibly other data is also not being received.
The strange thing is that this code works seamlessly with PHP 5.6.
Previous Comments:
------------------------------------------------------------------------
[2016-10-03 22:12:53] ksmiley at salesforce dot com
I didn't realize I wouldn't be able to edit the "test script" section.
Here's the PR with a test: https://github.com/php/php-src/pull/2153
------------------------------------------------------------------------
[2016-10-03 21:48:38] ksmiley at salesforce dot com
Description:
------------
When a WSDL declares a complex type with an "any" element and the SOAP response includes
multiple fields that will all be placed under the generic "any" element, if one of the
response fields is another complex type, it will overwrite the other fields.
Test script:
---------------
Will link to a pull request with a test case after submitting this.
Expected result:
----------------
["any"]=>
array(2) {
[0]=>
string(175)
"<sf:CampaignId>701i0000001lreeAAA</sf:CampaignId><sf:Status>Sent</sf:Status><sf:ContactId
xsi:nil="true"/><sf:LeadId>1UrbYFEAZ</sf:LeadId><sf:Contact
xsi:nil="true"/>"
["Lead"]=>
object(stdClass)#5 (3) {
["type"]=>
string(4) "Lead"
["Id"]=>
NULL
["any"]=>
string(44) "<sf:Email>angela.lansbury@cbs.com</sf:Email>"
}
}
Actual result:
--------------
["any"]=>
array(2) {
[0]=>
object(stdClass)#5 (3) {
["type"]=>
string(4) "Lead"
["Id"]=>
NULL
["any"]=>
string(44) "<sf:Email>angela.lansbury@cbs.com</sf:Email>"
}
["Lead"]=>
object(stdClass)#5 (3) {
["type"]=>
string(4) "Lead"
["Id"]=>
NULL
["any"]=>
string(44) "<sf:Email>angela.lansbury@cbs.com</sf:Email>"
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73237&edit=1