|  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
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-06-20 02:40 UTC] jasper at digiweb dot co dot nz
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));

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"/>

== OR ==

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

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
 [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
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jan 24 16:03:41 2022 UTC