|  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
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.
Block user comment
Status: Assign to:
Bug Type:
From: webmaster at guestwho dot com
New email:
PHP Version: OS:


 [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 24 00:01:26 2018 UTC