php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41745 PHP incorrectly encodes null values in SOAP
Submitted: 2007-06-20 02:40 UTC Modified: 2007-06-29 01:00 UTC
Votes:21
Avg. Score:4.9 ± 0.3
Reproduced:20 of 20 (100.0%)
Same Version:6 (30.0%)
Same OS:14 (70.0%)
From: jasper at digiweb dot co dot nz Assigned:
Status: No Feedback Package: SOAP related
PHP Version: 5.2.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jasper at digiweb dot co dot nz
New email:
PHP Version: OS:

 

 [2007-06-20 02:40 UTC] jasper at digiweb dot co dot nz
Description:
------------
When null is provided for a SOAP parameter or the field of an object passed as a SOAP parameter, PHP incorrectly encodes the parameter as being empty (e.g. object with all null fields, or empty string) which is different from an actual null. This breaks access to real-world web services.

Reproduce code:
---------------
$soap = new SoapClient('/path/to/wsdl', array('trace' => true));
$soap->operation(null);

echo $soap->__getLastRequest();

Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="NAMESPACE"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:operation>
<paramName xsi:nil="true"/>
</ns1:operation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

== OR ==

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="NAMESPACE">
<SOAP-ENV:Body>
<ns1:operation/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="NAMESPACE">
<SOAP-ENV:Body>
<ns1:operation>
<paramName/>
</ns1:operation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-29 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".
 [2007-09-25 11:00 UTC] fredrik at wangel dot net
Verified on PHP 5.2.4. Reported bug is still unsolved. In addition, NULL values in array responses are also handled incorrectly.

I have prepared a bug41745.phpt file (based on bug39815.phpt) that will test for the above cases and two other cases that are currently working in PHP 5.2.4 (included for regression testing).

Should I attach the code in a comment or send it directly to someone with CVS write access? In the meantime, get it from http://wangel.net/fredrik/php/bugs/bug41745.phpt
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 18:01:33 2024 UTC