php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50675 SoapClient can't handle object references correctly.
Submitted: 2010-01-06 08:46 UTC Modified: 2017-10-24 08:08 UTC
Votes:21
Avg. Score:4.3 ± 1.2
Reproduced:14 of 15 (93.3%)
Same Version:7 (50.0%)
Same OS:10 (71.4%)
From: margaritisz dot oresztesz at dotroll dot hu Assigned:
Status: Closed Package: SOAP related
PHP Version: 5.2.12 OS: Linux
Private report: No CVE-ID: None
 [2010-01-06 08:46 UTC] margaritisz dot oresztesz at dotroll dot hu
Description:
------------
When sending the same object multiple times in a SOAP call, SoapClient replaces the object with a href='..' object reference. However the client generates the request envelope with an incorrect parameter name, so the server does not get the referenced object.

Reproduce code:
---------------
Sources of a simple server and client could be found at the following URL: http://charlie.extra.hu/php-soap/soap.tar.gz

If I run client.php, it gets back an object filled with null parameters. It should recieve the first object sent to the server.
If I change the reference's parameter name to 'secondUser', the SOAP response includes the correct object.

Expected result:
----------------
Expected the following soap envelope to be sent:

<SOAP-ENV:test>
  <firstUser id="ref1">
    <userId>1</userId>
    <userName>user</userName>
  </firstUser>
  <secondUser href="#ref1"/>
</SOAP-ENV:test>

Actual result:
--------------
Got this request:

<SOAP-ENV:test>
  <firstUser id="ref1">
    <userId>1</userId>
    <userName>user</userName>
  </firstUser>
  <firstUser href="#ref1"/>
</SOAP-ENV:test>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-13 13:53 UTC] srinatar@php.net
the client.php that you attached is tar.gz of the same server side code. 
pl.attach / provide appropriate client reproduce code 
 [2010-01-15 12:05 UTC] margaritisz dot oresztesz at dotroll dot hu
Package on the previous link is damaged.

Source code can be found at:
http://code.dotroll.com/files/bugreports/php-50675-soaprefs/soap.tar.gz
 [2010-07-06 07:20 UTC] bulk at janoszen dot hu
Is somebody looking into this?
 [2010-12-09 04:47 UTC] srinatar@php.net
-Assigned To: srinatar +Assigned To:
 [2011-01-23 00:10 UTC] bulk at janoszen dot hu
Confirmed in PHP 5.3.4, still the same bug. The only fix for us is porting the SOAP library from 5.2.0, which has other, more manageable bugs.
 [2011-01-23 11:07 UTC] kayapo at molnaristvan dot eu
I use PHP 5.3.5 (from backports) in Debian GNU/Linux 5.0.7 Lenny. My resoults:

PHP SOAP client with Apache2 http request
=========================================
kayapo@ponyfarm:~$ wget http***kayapo.dev.molnaristvan.eu/client.php -O -
--2011-01-23 10:56:44--  http***kayapo.dev.molnaristvan.eu/client.php
kayapo.dev.molnaristvan.eu feloldása… 192.168.69.60
Csatlakozás a következőhöz: kayapo.dev.molnaristvan.eu[192.168.69.60]:80… kapcsolódva.
HTTP kérés elküldve, várakozás válaszra… 200 OK
Hossz: 682 [text/html]
Mentés ide: „STDOUT”

 0% [                                                                                                                                                                                                    ] 0           --.-K/s              --- test ---
REQUEST: 
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http***schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:test><firstUser id="ref1"><userId>1</userId><userName>username</userName></firstUser><firstUser href="#ref1"/></SOAP-ENV:test></SOAP-ENV:Body></SOAP-ENV:Envelope>

RESPONSE MSG: 
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http***schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:testResponse><response/></SOAP-ENV:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

RESPONSE: 
object(User)#3 (2) {
  ["userId":"User":private]=>
  NULL
  ["userName":"User":private]=>
  NULL
}
100%[===================================================================================================================================================================================================>] 682         --.-K/s   idő 0s     

2011-01-23 10:56:44 (115 MB/s) --  kiírva a szabványos kimenetre [682/682]

PHP SOAP client from command line
=================================
kayapo@www:~/workspace/site/frontend$ php client.php                                                                                                                                                                                         
--- test ---                                                                                                                                                                                                                                 
REQUEST:                                                                                                                                                                                                                                     
<?xml version="1.0" encoding="UTF-8"?>                                                                                                                                                                                                       
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http***schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:test><firstUser id="ref1"><userId>1</userId><userName>username</userName></firstUser><firstUser href="#ref1"/></SOAP-ENV:test></SOAP-ENV:Body></SOAP-ENV:Envelope>                                                                                                                                                                                                                 
                                                                                                                                                                                                                                             
RESPONSE MSG:                                                                                                                                                                                                                                
<?xml version="1.0" encoding="UTF-8"?>                                                                                                                                                                                                       
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http***schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:testResponse><response/></SOAP-ENV:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>                                                  
                                                                                                                                                                                                                                             
RESPONSE:                                                                                                                                                                                                                                    
object(User)#3 (2) {                                                                                                                                                                                                                         
  ["userId":"User":private]=>                                                                                                                                                                                                                
  NULL
  ["userName":"User":private]=>
  NULL
}
 [2011-01-24 12:25 UTC] wenz@php.net
@ bulk at janoszen dot hu: which PHP 5.2 version could you confirm as working as expected?
 [2011-01-24 12:27 UTC] bulk at janoszen dot hu
We currently patch the SOAP library from 5.2.0 into our installations, which works as expected.
 [2012-03-01 16:07 UTC] bulk at janoszen dot hu
This bug is now open for more than 2 years. Would somebody please take a look at it?
 [2014-01-22 06:59 UTC] dmitry@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: dmitry
 [2017-10-24 08:08 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: dmitry +Assigned To:
 [2018-10-06 06:22 UTC] camporter1 at gmail dot com
Attempted fix on https://github.com/php/php-src/pull/3584 (couldn't attach this PR)
 [2018-10-23 12:27 UTC] nikic@php.net
Automatic comment on behalf of camporter1@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=db47e35373513705b84b7391ed25e9854308eef2
Log: Fixed bug #50675
 [2018-10-23 12:27 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC