php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73237 Nested object in "any" element overwrites other fields
Submitted: 2016-10-03 21:48 UTC Modified: 2016-10-03 22:12 UTC
Votes:10
Avg. Score:4.6 ± 0.7
Reproduced:9 of 9 (100.0%)
Same Version:9 (100.0%)
Same OS:8 (88.9%)
From: ksmiley at salesforce dot com Assigned:
Status: Closed Package: SOAP related
PHP Version: 7.0.11 OS: Any
Private report: No CVE-ID: None
 [2016-10-03 21:48 UTC] 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>"
  }
}

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-03 22:12 UTC] 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-05 02:25 UTC] fgs dot inacio at gmail dot com
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.
 [2016-10-12 21:14 UTC] nikic@php.net
Automatic comment on behalf of ksmiley@salesforce.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=26287132c0c48e52dbaf1ac44c1d2f0d0d9b0cf7
Log: Fixed bug #73237
 [2016-10-12 21:14 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2016-10-12 21:16 UTC] nikic@php.net
Automatic comment on behalf of ksmiley@salesforce.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=26287132c0c48e52dbaf1ac44c1d2f0d0d9b0cf7
Log: Fixed bug #73237
 [2016-10-14 01:02 UTC] ab@php.net
Automatic comment on behalf of ksmiley@salesforce.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ddaf04053beec2c9bbb63e1d9b99efdb6aabbf4e
Log: Fixed bug #73237
 [2016-10-14 02:22 UTC] ab@php.net
Automatic comment on behalf of ksmiley@salesforce.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=26287132c0c48e52dbaf1ac44c1d2f0d0d9b0cf7
Log: Fixed bug #73237
 [2016-10-14 02:23 UTC] ab@php.net
Automatic comment on behalf of ksmiley@salesforce.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ddaf04053beec2c9bbb63e1d9b99efdb6aabbf4e
Log: Fixed bug #73237
 [2016-10-17 10:06 UTC] bwoebi@php.net
Automatic comment on behalf of ksmiley@salesforce.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ddaf04053beec2c9bbb63e1d9b99efdb6aabbf4e
Log: Fixed bug #73237
 [2016-10-17 10:07 UTC] bwoebi@php.net
Automatic comment on behalf of ksmiley@salesforce.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=26287132c0c48e52dbaf1ac44c1d2f0d0d9b0cf7
Log: Fixed bug #73237
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC