|  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: -
Avg. Score:4.0 ± 0.9
Reproduced:6 of 7 (85.7%)
Same Version:4 (66.7%)
Same OS:2 (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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-06-20 23:24 UTC] webmaster at guestwho dot com
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));

echo $soap->__getLastRequest();

Expected result:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1="NAMESPACE"
<paramName xsi:nil="true"/>

Actual result:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1="NAMESPACE">


Add a Patch

Pull Requests

Add a Pull Request


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-2018 The PHP Group
All rights reserved.
Last updated: Wed Oct 17 05:01:26 2018 UTC