php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51273 Faultstring property does not exist when the faultstring is empty
Submitted: 2010-03-11 13:55 UTC Modified: 2010-06-09 17:48 UTC
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:4 (80.0%)
From: dennis at transip dot nl Assigned: iliaa
Status: Closed Package: SOAP related
PHP Version: 5.2.13 OS: FreeBSD 7.0-STABLE
Private report: No CVE-ID:
 [2010-03-11 13:55 UTC] dennis at transip dot nl
Description:
------------
When a SoapServer sends back a SoapFault response with an empty faultstring, PHP will not set the $faultstring property of the thrown SoapFault object.

The following SOAP response will result in the $faultstring property not being set:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>test</faultcode><faultstring></faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

Test script:
---------------
server.php: 
<?php
$server = new SoapServer(null, array('uri' => "http://test-uri/"));
function test($inputString) {
    global $server;
    $server->fault('test', '');
}
$server->addFunction("test");
$server->handle();
?>

client.php:
<?php
$client = new SoapClient(null, array('location' => "http://localhost/server.php",'uri'=> "http://test-uri/"));
try{
 echo $client->test('hello?');
}
catch(SoapFault $f) {
   echo isset($f->faultstring) ? "has faultstring\n" : "no faultstring\n";
}
?>

Expected result:
----------------
has faultstring


Actual result:
--------------
no faultstring


Patches

soap-faultstring-not-set-patch.diff (last revision 2010-03-11 12:55 UTC) by dennis at transip dot nl)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-03 19:48 UTC] pajoye@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=298919
Log: - #51273, Content-length header is limited to 32bit integer with apache2/windows
 [2010-05-03 21:53 UTC] pajoye@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=298931
Log: - revert #51273
 [2010-06-09 17:48 UTC] iliaa@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=300317
Log: Fixed bug #51273 (Faultstring property does not exist when the faultstring is empty)

# Patch by dennis at transip dot nl
 [2010-06-09 17:48 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 09:02:28 2014 UTC