Bug #51273 [NEW]: Faultstring property does not exist when the faultstring is empty

From: Date: Thu, 11 Mar 2010 12:55:16 +0000
Subject: Bug #51273 [NEW]: Faultstring property does not exist when the faultstring is empty
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148509@lists.php.net to get a copy of this message
From:             
Operating system: FreeBSD 7.0-STABLE
PHP version:      5.2.13
Package:          SOAP related
Bug Type:         Bug
Bug description:Faultstring property does not exist when the faultstring is empty

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


-- 
Edit bug report at http://bugs.php.net/bug.php?id=51273&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51273&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51273&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51273&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51273&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51273&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51273&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51273&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51273&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51273&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51273&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51273&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51273&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51273&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51273&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51273&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51273&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51273&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51273&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51273&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51273&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51273&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#148509) next »