|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28321 Duplicate Tags in SOAP message parsed incorrectly.
Submitted: 2004-05-07 20:36 UTC Modified: 2004-07-19 17:40 UTC
Avg. Score:4.8 ± 0.6
Reproduced:20 of 21 (95.2%)
Same Version:9 (45.0%)
Same OS:5 (25.0%)
From: ronunism at hotmail dot com Assigned: dmitry (profile)
Status: No Feedback Package: SOAP related
PHP Version: 5CVS-2004-05-07 (dev) OS: Fedora Core 1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
25 + 33 = ?
Subscribe to this entry?

 [2004-05-07 20:36 UTC] ronunism at hotmail dot com
Using PHP5's SoapClient to recieve a SOAP envelope that contains multiple instances of the same tag, the resulting object retains only the last item of the given tag name.
E.G.  Receiving a SOAP message containing:

Results in an object containing:

[dogs] => stdClass Object
            [dog] => Benji

I'm using a perl SOAP::Lite script for the server, and php5's SOAP for the client.  When the tags are changed to be unique (e.g. <dog1>, <dog2>, <dog3>) all three examples are returned as expected.

Reproduce code:
[ TestFunction is a simple function that returns a SOAP envelope containing: 

$client is the PHP5 SoapClient variable. ]

$test = $client->__call('TestFunction', array($a));

echo '<pre>';
echo '</pre>';

Expected result:
stdClass Object
    [dogs] => array
        [0] => Scooby
        [1] => Lassie
        [2] => Benji

Actual result:
stdClass Object
    [dogs] => stdClass Object
            [dog] => Benji


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-21 17:03 UTC]
May be the problem in WSDL file?
Can you put here WSDL file, SOAP request (XML) and SOAP response?
 [2006-01-16 01:22 UTC] marc dot greenstock at gmail dot com
I am experiencing the same problem with the MSN Search API. More specifically on the SourceRequest objects, where there are 4 tags of the same name.
 [2006-02-03 15:48 UTC] PiRanha_777 at yahoo dot fr
I have the same problem.
I think the problem comes from the fact that, as the SOAP response is stored in associative arrays, when there are 2 (or more) tags with the same name the value of the second tag replace the value of first one.
 [2008-07-07 11:09 UTC] iant at clickwt dot com
I have also seen this problem, both in sending and parsing soap requests. I agree that it seems to be because they are internally stored as associative arrays, something which is more obvious to the user when sending requests.
 [2008-09-20 09:41 UTC] bramhavers at gmail dot com
Same problem exists for sending the same element multiple times.
See post for problem description:
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Dec 03 05:01:30 2023 UTC