php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49013 SOAPClient interprets the parameters array incorrectly
Submitted: 2009-07-22 07:20 UTC Modified: 2018-05-06 16:48 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: egos at biz-club dot biz Assigned:
Status: Re-Opened Package: SOAP related
PHP Version: 5.5.1 OS: debian Lenny
Private report: No CVE-ID: None
 [2009-07-22 07:20 UTC] egos at biz-club dot biz
Description:
------------
on Debian Lenny (php 5.2.6.dfsg.1-1+lenny3) i run the simple call.

please, take a look at var_dump of the parameters variable and at the generated xml code

Before xml is generated, it sorts the parameters, so that values loose bindings to the keys of the array.

Reproduce code:
---------------
$client->__soapCall("updateMonitoring", $parameters);
var_dump($parameters);
echo "<br><hr>";
echo " REQUEST:\n" . $client->__getLastRequest() . "\n<br><hr>";




Expected result:
----------------
correct xml, based on $parameters. Here,s the var_dump of it $parameters I put there

  ["login"]=>
  string(4) "***"
  ["password"]=>
  string(32) "***"
  ["monitoring_id"]=>
  string(5) "18700"
  ["plan_budget_total"]=>
  string(2) "70"
  ["plan_budget_navigation"]=>
  string(1) "0"
  ["plan_pay"]=>
  string(2) "25"
  ["total"]=>
  int(66)
  ["task_training"]=>
  int(0)
  ["without_preliminary_examination"]=>
  int(0)
  ["without_competition"]=>
  int(0)
  ["city_0_59"]=>
  int(0)
  ["city_60_100"]=>
  int(0)
  ["city_101_110"]=>
  int(0)
  ["city_111_120"]=>
  int(0)
  ["city_121_130"]=>
  int(0)
  ["city_131_140"]=>
  int(0)
  ["city_141_150"]=>
  int(1)
  ["city_151_160"]=>
  int(1)
  ["city_161_170"]=>
  int(2)
  ["city_171_180"]=>
  int(0)
  ["city_181_190"]=>
  int(2)
  ["city_191_200"]=>
  int(2)
  ["city_201_210"]=>
  int(5)
  ["city_211_220"]=>
  int(3)
  ["city_221_230"]=>
  int(1)
  ["city_231_240"]=>
  int(8)
  ["city_241_250"]=>
  int(1)
  ["city_251_260"]=>
  int(4)
  ["city_261_270"]=>
  int(2)
  ["city_271_280"]=>
  int(5)
  ["city_281_290"]=>
  int(5)
  ["city_291_300"]=>
  int(3)
  ["city_301_310"]=>
  int(10)
  ["city_311_320"]=>
  int(3)
  ["city_321_330"]=>
  int(2)
  ["city_331_340"]=>
  int(2)
  ["city_341_400"]=>
  int(1)
  ["country_0_59"]=>
  int(0)
  ["country_60_100"]=>
  int(0)
  ["country_101_110"]=>
  int(0)
  ["country_111_120"]=>
  int(0)
  ["country_121_130"]=>
  int(0)
  ["country_131_140"]=>
  int(0)
  ["country_141_150"]=>
  int(0)
  ["country_151_160"]=>
  int(0)
  ["country_161_170"]=>
  int(0)
  ["country_171_180"]=>
  int(0)
  ["country_181_190"]=>
  int(0)
  ["country_191_200"]=>
  int(0)
  ["country_201_210"]=>
  int(1)
  ["country_211_220"]=>
  int(1)
  ["country_221_230"]=>
  int(0)
  ["country_231_240"]=>
  int(0)
  ["country_241_250"]=>
  int(1)
  ["country_251_260"]=>
  int(0)
  ["country_261_270"]=>
  int(0)
  ["country_271_280"]=>
  int(0)
  ["country_281_290"]=>
  int(0)
  ["country_291_300"]=>
  int(0)
  ["country_301_310"]=>
  int(0)
  ["country_311_320"]=>
  int(0)
  ["country_321_330"]=>
  int(0)
  ["country_331_340"]=>
  int(0)
  ["country_341_400"]=>
  int(0)
}

Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:abiturient" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:updateMonitoring><login xsi:type="xsd:string">***</login><password xsi:type="xsd:string">***</password><monitoring_id xsi:type="xsd:int">18700</monitoring_id><plan_budget_total xsi:type="xsd:int">70</plan_budget_total><plan_budget_navigation xsi:type="xsd:int">0</plan_budget_navigation><plan_pay xsi:type="xsd:int">25</plan_pay><total xsi:type="xsd:int">66</total><task_training xsi:type="xsd:int">0</task_training><without_preliminary_examination xsi:type="xsd:int">0</without_preliminary_examination><without_competition xsi:type="xsd:int">0</without_competition><city_341_400 xsi:type="xsd:int">0</city_341_400><country_341_400 xsi:type="xsd:int">0</country_341_400><city_331_340 xsi:type="xsd:int">0</city_331_340><country_331_340 xsi:type="xsd:int">0</country_331_340><city_321_330 xsi:type="xsd:int">0</city_321_330><country_321_330 xsi:type="xsd:int">0</country_321_330><city_311_320 xsi:type="xsd:int">1</city_311_320><country_311_320 xsi:type="xsd:int">1</country_311_320><city_301_310 xsi:type="xsd:int">2</city_301_310><country_301_310 xsi:type="xsd:int">0</country_301_310><city_291_300 xsi:type="xsd:int">2</city_291_300><country_291_300 xsi:type="xsd:int">2</country_291_300><city_281_290 xsi:type="xsd:int">5</city_281_290><country_281_290 xsi:type="xsd:int">3</country_281_290><city_271_280 xsi:type="xsd:int">1</city_271_280><country_271_280 xsi:type="xsd:int">8</country_271_280><city_261_270 xsi:type="xsd:int">1</city_261_270><country_261_270 xsi:type="xsd:int">4</country_261_270><city_251_260 xsi:type="xsd:int">2</city_251_260><country_251_260 xsi:type="xsd:int">5</country_251_260><city_241_250 xsi:type="xsd:int">5</city_241_250><country_241_250 xsi:type="xsd:int">3</country_241_250><city_231_240 xsi:type="xsd:int">10</city_231_240><country_231_240 xsi:type="xsd:int">3</country_231_240><city_221_230 xsi:type="xsd:int">2</city_221_230><country_221_230 xsi:type="xsd:int">2</country_221_230><city_211_220 xsi:type="xsd:int">1</city_211_220><country_211_220 xsi:type="xsd:int">0</country_211_220><city_201_210 xsi:type="xsd:int">0</city_201_210><country_201_210 xsi:type="xsd:int">0</country_201_210><city_191_200 xsi:type="xsd:int">0</city_191_200><country_191_200 xsi:type="xsd:int">0</country_191_200><city_181_190 xsi:type="xsd:int">0</city_181_190><country_181_190 xsi:type="xsd:int">0</country_181_190><city_171_180 xsi:type="xsd:int">0</city_171_180><country_171_180 xsi:type="xsd:int">0</country_171_180><city_161_170 xsi:type="xsd:int">0</city_161_170><country_161_170 xsi:type="xsd:int">0</country_161_170><city_151_160 xsi:type="xsd:int">0</city_151_160><country_151_160 xsi:type="xsd:int">1</country_151_160><city_141_150 xsi:type="xsd:int">1</city_141_150><country_141_150 xsi:type="xsd:int">0</country_141_150><city_131_140 xsi:type="xsd:int">0</city_131_140><country_131_140 xsi:type="xsd:int">1</country_131_140><city_121_130 xsi:type="xsd:int">0</city_121_130><country_121_130 xsi:type="xsd:int">0</country_121_130><city_111_120 xsi:type="xsd:int">0</city_111_120><country_111_120 xsi:type="xsd:int">0</country_111_120><city_101_110 xsi:type="xsd:int">0</city_101_110><country_101_110 xsi:type="xsd:int">0</country_101_110><city_60_100 xsi:type="xsd:int">0</city_60_100><country_60_100 xsi:type="xsd:int">0</country_60_100><city_0_59 xsi:type="xsd:int">0</city_0_59><country_0_59 xsi:type="xsd:int">0</country_0_59></ns1:updateMonitoring></SOAP-ENV:Body></SOAP-ENV:Envelope>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-03 15:17 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-08-11 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2013-09-04 13:54 UTC] cweiske@php.net
-Status: No Feedback +Status: Re-Opened -PHP Version: 5.2.6 +PHP Version: 5.5.1
 [2013-09-04 13:54 UTC] cweiske@php.net
We can reproduce the issue on PHP 5.1, see the files at http://p.cweiske.de/53:

SoapClient: http://p.cweiske.de/53/raw/soapclienttest.php
WSDL: http://p.cweiske.de/53/raw/test.wsdl

We give an associative array of parameters:

$arguments = array(
    'password' => 'password-value',
    'username' => 'username-value',
);

But the SOAP request has the values in wrong order:

<username xsi:type="xsd:string">password-value</username>
<password xsi:type="xsd:string">username-value</password>
 [2013-09-09 07:50 UTC] cweiske@php.net
I meant PHP 5.5.1, not 5.1.
 [2018-05-06 16:28 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2018-05-06 16:28 UTC] cmb@php.net
SoapClient::__call() ignores the array keys, analogously to
call_user_func_array(), so this is merely a doc issue.
 [2018-05-06 16:33 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem
 [2018-05-06 16:48 UTC] cmb@php.net
-Type: Documentation Problem +Type: Bug -Assigned To: cmb +Assigned To:
 [2018-05-06 16:48 UTC] cmb@php.net
Hmm, the documentation explicitly states:

| This can be either an ordered or an associative array. Note that
| most SOAP servers require parameter names to be provided, in which
| case this must be an associative array.

According to the implementation this appears to be wrong, since a
copy of the $arguments array is created via
ZEND_HASH_FOREACH_VAL[1]. However, I'm not sure how it is supposed
to work, so I'm changing back to bug.

[1] <https://github.com/php/php-src/blob/PHP-7.2.5/ext/soap/soap.c#L2904-L2909>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 05:01:31 2024 UTC