php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62378 PHP incorrectly encodes null values in SOAP
Submitted: 2012-06-20 23:24 UTC Modified: -
Votes:5
Avg. Score:4.0 ± 0.9
Reproduced:3 of 4 (75.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: webmaster at guestwho dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.3.14 OS: FreeBSD 8.3-RELEASE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: webmaster at guestwho dot com
New email:
PHP Version: OS:

 

 [2012-06-20 23:24 UTC] webmaster at guestwho dot com
Description:
------------
This is a duplicate of #41745 but that's been stuck on "No Feedback" since 2007, so I thought I'd re-post.

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.

Test script:
---------------
---------------
$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>

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
 [2012-11-21 18:28 UTC] seth at sethmatics dot com
Not sure what version of PHP your using, but my version of PHP is properly setting 
the xsi:nil on NULL values. I found this bug while searching for issue with 
"disappearing nodes when value is null".
 [2013-06-18 14:47 UTC] koblavino at gmail dot com
Please, can somebody tell me in which PHP version we dont get this problem?
 [2017-07-25 03:33 UTC] peter_liang at vtech dot com
Please see if the solution in #74984 addresses this issue.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC